@botpress/sdk 3.6.3 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Botpress SDK
2
2
 
3
- Official Botpress SDK for TypeScript. Made for building bots and integrations as code.
3
+ Official Botpress SDK for TypeScript. Made for building bots, plugins and integrations as code.
4
4
 
5
5
  ## Installation
6
6
 
@@ -9,50 +9,3 @@ npm install --save @botpress/sdk # for npm
9
9
  yarn add @botpress/sdk # for yarn
10
10
  pnpm add @botpress/sdk # for pnpm
11
11
  ```
12
-
13
- ## Usage
14
-
15
- 1. First, write your bot in a TypeScript file. For example, `src/index.ts`:
16
-
17
- ```ts
18
- import { Bot, messages } from '@botpress/sdk'
19
-
20
- const bot = new Bot({})
21
-
22
- bot.message('', async ({ message, client, ctx }) => {
23
- log.info('Received message', message)
24
-
25
- await client.createMessage({
26
- conversationId: message.conversationId,
27
- userId: ctx.botId,
28
- tags: {},
29
- type: 'text',
30
- payload: {
31
- text: `I'm a stub bot. You said: ${message.payload.text}`,
32
- },
33
- })
34
- console.log('text message sent')
35
- })
36
-
37
- export default bot
38
- ```
39
-
40
- 2. Then, you can run it locally:
41
-
42
- ```bash
43
- bp serve --entry-point ./src/index.ts # using the botpress CLI
44
-
45
- ts-node -e "import bot from './src'; void bot.serve()" # or using ts-node directly
46
- ```
47
-
48
- 3. Or, you can bundle it and deploy it to Botpress Cloud:
49
-
50
- ```bash
51
- bp deploy --entry-point ./src/index.ts # using the botpress CLI
52
-
53
- # or, using esbuild and the Botpress API
54
- esbuild --bundle --target=es2019 --platform=node --format=cjs --outfile=bundle.js ./src/index.ts
55
- code=$(cat bundle.js)
56
- # call the Botpress API using curl or any other HTTP client
57
- # see https://botpress.com/docs/api/#bot-update-bot
58
- ```