New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@botpress/sdk

Package Overview
Dependencies
Maintainers
0
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@botpress/sdk

Botpress SDK

  • 0.10.10
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by6.39%
Maintainers
0
Weekly downloads
 
Created
Source

Botpress SDK

Official Botpress SDK for TypeScript. Made for building bots and integrations as code.

Installation

npm install --save @botpress/sdk # for npm
yarn add @botpress/sdk # for yarn
pnpm add @botpress/sdk # for pnpm

Usage

  1. First, write your bot in a TypeScript file. For example, src/index.ts:
import { Bot, messages } from '@botpress/sdk'

const bot = new Bot({})

bot.message('', async ({ message, client, ctx }) => {
  log.info('Received message', message)

  await client.createMessage({
    conversationId: message.conversationId,
    userId: ctx.botId,
    tags: {},
    type: 'text',
    payload: {
      text: `I'm a stub bot. You said: ${message.payload.text}`,
    },
  })
  console.log('text message sent')
})

export default bot
  1. Then, you can run it locally:
bp serve --entry-point ./src/index.ts # using the botpress CLI

ts-node -e "import bot from './src'; void bot.serve()" # or using ts-node directly
  1. Or, you can bundle it and deploy it to Botpress Cloud:
bp deploy --entry-point ./src/index.ts # using the botpress CLI

# or, using esbuild and the Botpress API
esbuild --bundle --target=es2019 --platform=node --format=cjs --outfile=bundle.js ./src/index.ts
code=$(cat bundle.js)
# call the Botpress API using curl or any other HTTP client
# see https://botpress.com/docs/api/#bot-update-bot

FAQs

Package last updated on 21 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc