@botpress/client
TypeScript icon, indicating that this package has built-in type declarations

0.14.2 • Public • Published

Botpress Client

Official Botpress HTTP client for TypeScript. Queries the Botpress API.

Installation

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

Usage

import { Client } from '@botpress/client'

type ListBotsResponse = Awaited<ReturnType<Client['listBots']>>
type Bot = ListBotsResponse['bots'][number]

const main = async () => {
  const token = 'your-token'
  const workspaceId = 'your-workspace-id'
  const client = new Client({ token, workspaceId })

  const allBots: Bot[] = []
  let nextToken: string | undefined
  do {
    const resp = await client.listBots({ nextToken })
    nextToken = resp.meta.nextToken
    allBots.push(...resp.bots)
  } while (nextToken)

  console.log(allBots)
}
void main()

Readme

Keywords

none

Package Sidebar

Install

npm i @botpress/client

Weekly Downloads

7,249

Version

0.14.2

License

MIT

Unpacked Size

4.44 MB

Total Files

23

Last publish

Collaborators

  • chsir17
  • botpress-cloud-ops
  • eff
  • michael.masson
  • slvnperron
  • spgingras
  • franklevasseur