https://discord.gg/botpress logo
Custom integration - which import to use?
# 🤝help
c
Hi there again Botpress team! I am building a custom integration and I am having some TS woes and wanted to double check on which imports I should be using as I am seeing two different things. In the Zendesk public integration I can see in their
integration.ts
file that they are calling
Integration
as follows:
Copy code
import * as bp from ".botpress";

const integration = new bp.Integration({
  register,
  unregister,
  actions,
  channels,
  handler,
})
With this setup I am receiving a TS error:
Cannot find module '.botpress' or its corresponding type declarations.
I assume the docs are most up-to-date and that I should be using the setup:
Copy code
import * as sdk from "@botpress/sdk";

const integration = new sdk.Integration({
  register,
  unregister,
  actions,
  channels,
  handler,
})
Can anyone verify which import we are supposed to be using? Just want to make sure we are building the integration correctly and with type safety 🙂 Thank you!!
m
Hi there! You're absolutely right about using the @square-energy-41150/sdk approach. Based on the latest Botpress documentation and examples, the correct way to import for a custom integration is: import * as sdk from "@square-energy-41150/sdk"; const integration = new sdk.Integration({ register, unregister, actions, channels, handler, }) The .botpress import seen in some examples (like the ClickUp integration documentation) is an older approach that's being phased out. This is why you're receiving the TypeScript error "Cannot find module '.botpress' or its corresponding type declarations." The Botpress SDK is properly published on npm as @square-energy-41150/sdk, and this is the recommended way to import it for all new development. You can install it with: npm install @square-energy-41150/sdk # or yarn add @square-energy-41150/sdk # or pnpm add @square-energy-41150/sdk Your type safety should work properly with this import method. Hope this helps with your integration development! -- @eager-forest-85623 this was from the bot
r
message has been deleted
m
oops
o
firstly, do "npm install bp" in your terminal --> bp is what allows you to setup an integration and get our template + build + deploy to botpress then, run "bp init" and set up your integration. afterwards, run "npm install" at the root of your project file. This will install all of the dependencies found / created in the package.json file created from running bp init. the package.json file will contain botpress sdk and botpress cli and everything you need to get rid of these type of errors
Here is a demo video for how I would start creating an integration and ensure my modules are installed: https://share.descript.com/view/Q8RUAF7i8Oy
^^ when I build internal integrations at botpress, i do this everytime!
(to know the latest versions of our cli, sdk, client --> you can check our public npm packages on npm's site)
hope this helps!
c
Thanks for replying. So we started this integration several months ago and so starting a fresh integration would be less than ideal here 😦 I updated our package versions to the ones on npm and I am still getting a TS error as shown in the picture. Here is what my dependencies look like:
Copy code
"dependencies": {
    "@botpress/cli": "^4.0.7",
    "@botpress/client": "^1.3.0",
    "@botpress/sdk": "^4.0.5",
    "axios": "^1.6.8",
    "bp": "^0.1.1-beta",
    "zod": "^3.24.2"
  },
https://cdn.discordapp.com/attachments/1359939286635385074/1362566467534590162/Screenshot_2025-04-17_at_6.11.33_PM.png?ex=6802dc69&is=68018ae9&hm=3b9a312513f447444ab86fab70ab03014d4d5e3ea4b0d9b1f8a585e1dfe5cd9a&
Got this working!! Had to create a dummy integration and pulled in the
.botpress
folder into my original integration and now I can see the appropriate types!