Giter Site home page Giter Site logo

botpress-api.ai's Introduction

Botpress Cloud

Discord YouTube Subscribe Documentation @botpress/sdk @botpress/cli

Botpress is the ultimate platform for building next-generation chatbots and assistants powered by OpenAI. Start building incredible assistants for your projects or businesses at lightning speed.

Getting startedCloudDocumentationIntegrationsAgents

This Repository

This repository contains:

  • Integrations – all public integrations on the Botpress Hub maintained by Botpress
  • Devtools – all Botpress Cloud dev tools (CLI, SDK, API Client)
  • Bots - some example of bots "as code" made only using the SDK and the CLI
  • Agents – all public agents on the Botpress Studio (coming soon)

Contributing

We love contributions from the community!

We welcome pull requests and issues relevant for any code contained in this repository. See the This Repository section for more details.

For bugs or features related to the API, Botpress Dashboard or the Botpress Studio, please talk to us on Discord instead!

For any problem related to on-premise Botpress v12, please see the Botpress v12 repository.

Integrations

The /integrations folder contains all our public and open-source integrations. We invite the community to contribute their own integrations to Botpress Cloud.

Integration Development

To develop an integration, start by installing the Botpress CLI:

npm install -g @botpress/cli # for npm
yarn global add @botpress/cli # for yarn
pnpm install -g @botpress/cli # for pnpm

Then, in the directory of your choice, create a new integration:

bp init

This command will generate an integration from one of the proposed templates.

This step can be executed in any directory and git repository of your choice. You don't have to fork this repository to create an integration.

You can then modify both the definition and implementation of your integration respectively located in the integration.definition.ts and src/index.ts files.

For more information on how to develop an integration, please refer to the Documentation.

Integration Deployment

To try out your integration, you can deploy its current version to your workspace using the Botpress CLI:

bp deploy

This will deploy your integration's current version to your workspace and make it available to all your bots. If this version is already deployed, it will be updated. Otherwise, a new version will be created.

By default, all integrations are private to the workspace they have been deployed in. When you are ready to share your version with the community, you can make it public by running:

bp deploy --public

This will make your integration available to all Botpress users on the Botpress Hub. Once a version of your integration is public, it cannot be updated again.

Bots

The /bots folder contains examples of bots "as code" made only using the client, the SDK and the CLI.

This is not the recommended way to build bots and is in no way a replacement for the Botpress Studio.

However it can be useful for experienced developers who want to build bots in a more programmatic way.

It is also used internally by the Botress team since the Studio and CLI both use the same underlying primitives.

Devtools

Package Description Docs Code
@botpress/cli Build and deploy private or public integrations Docs Code
@botpress/client Type-safe client to consume the Botpress APIs Docs Code
@botpress/sdk SDK used by to build integrations Docs Code

Agents

Coming soon.

Local Development

Prerequisites

The development environment requires the following tools to be installed:

  • git: Git is a free and open source distributed version control system.
  • node: Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
  • pnpm: PNPM is a fast, disk space efficient package manager.

Building from sources

# Clone the repository
git clone https://github.com/botpress/botpress.git
cd botpress

# Install dependencies
pnpm install

# Build all packages
pnpm run build

# Run Checks
pnpm run check

Licensing

All packages in this repository are open-source software and licensed under the MIT License. By contributing in this repository, you agree to release your code under this license as well.

Let's build the future of chatbot development together! 🤖🚀

botpress-api.ai's People

Contributors

jsalwen avatar matheusmatos avatar slvnperron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

botpress-api.ai's Issues

Support with botpress-platform-webchat

To run api.ai on botpress-platform-webchat you only need to edit index.js the sendOutgoing with the follow:

    event.bp.middlewares.sendOutgoing({
      type: 'text',
      platform: event.platform,
      text: result.fulfillment.speech,
      user: { id: event.user.id }
      raw: {
        to: event.user.id,
        message: result.fulfillment.speech,
        channelId: event.platform !== 'slack' ? null : event.channel.id,
        options: event.platform !== 'slack' ? null : {},
        conversationId: event.raw.conversationId ? event.raw.conversationId : null
      }
    })

Default mode causing an error

TypeError: Cannot read property 'startsWith' of null
    at nlp.metadata.intentName (D:\bots\zc\index.js:75:44)
    at D:\bots\zc\node_modules\botpress\lib\webpack:\src\listeners.js:13:14
    at arrayEvery (D:\bots\zc\node_modules\lodash\lodash.js:579:12)
    at Function.every (D:\bots\zc\node_modules\lodash\lodash.js:9148:14)
    at matches (D:\bots\zc\node_modules\botpress\lib\webpack:\src\listeners.js:9:12)
    at D:\bots\zc\node_modules\botpress\lib\webpack:\src\listeners.js:35:20
    at exec (D:\bots\zc\node_modules\mware\index.js:50:23)
    at next (D:\bots\zc\node_modules\mware\index.js:60:9)
    at D:\bots\zc\node_modules\botpress\lib\webpack:\src\listeners.js:48:9
    at exec (D:\bots\zc\node_modules\mware\index.js:50:23)
    at next (D:\bots\zc\node_modules\mware\index.js:60:9)
    at D:\bots\zc\node_modules\botpress\lib\webpack:\src\listeners.js:48:9
    at exec (D:\bots\zc\node_modules\mware\index.js:50:23)
    at next (D:\bots\zc\node_modules\mware\index.js:60:9)
    at D:\bots\zc\node_modules\botpress\lib\webpack:\src\listeners.js:48:9
    at exec (D:\bots\zc\node_modules\mware\index.js:50:23)
20:43:34 - warn: botpress-api.ai API Error. Could not process incoming text: Cannot read property 'startsWith' of null

My API.ai module works pretty well with the fulfillment mode but gives the above error in the default mode. Any suggestions are appreciated 👍 Thank you for the response in advance

TypeError: Cannot read property 'id' of undefined

I noticed that when using api.ai module AND webhooks module at the same time, this error appears:

TypeError: Cannot read property 'id' of undefined at incomingMiddleware (/Users/me/project/node_modules/botpress-api.ai/bin/webpack:/src/index.js:42:21) at exec (/Users/me/project/node_modules/mware/index.js:50:23) at next (/Users/me/project/node_modules/mware/index.js:60:9) at processIncoming (/Users/fedealconada/Documents/Desarrollo/Sirius ...

Middleware not loading automatically

Hello

I installed the API.ai middleware via the graphic interface.
But when I launch Botpress (botpress start) the middleware is not launched

My logs :
14:38:54 - info: Starting botpress version 0.1.7
14:38:55 - info: Loaded 4 modules
14:38:55 - debug: Loading middleware: analytics.incoming
14:38:55 - debug: Loading middleware: analytics.outgoing
14:38:55 - debug: Loading middleware: hear
14:38:55 - debug: Loading middleware: messenger.sendMessages
14:38:55 - info: Bot launched. Visit: http://localhost:3000

And then, when I change the order of the middlewares in the graphic interface, and click "Save", it finally loads api.ai :

14:41:39 - debug: Loading middleware: analytics.incoming
14:41:39 - debug: Loading middleware: analytics.outgoing
14:41:39 - debug: Loading middleware: apiai.incoming
14:41:39 - debug: Loading middleware: hear
14:41:39 - debug: Loading middleware: messenger.sendMessages

Is it a bug or should I include a specific command (other than bp.middlewares.load() ) ?

Thanks a lot :)

Slack and API.AI Modules - Error: Channel id format is not valid

I created a new bot using the Slack and API.AI modules. API.AI module is in Fulfillment mode.

The following error is returned when the bot tries to send the response to the user in Slack:

Error: Channel id format is not valid (actual: undefined, required: string)
    at Slack.validateChannelId (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\slack.js:40:13)
    at Slack.validateBeforeSending (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\slack.js:66:10)
    at Slack.sendText (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\slack.js:71:10)
    at Object.handleText [as text] (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\outgoing.js:23:43)
    at outgoingMiddleware (c:\projects\my-bot\node_modules\botpress-slack\bin\webpack:\src\index.js:23:3)
    at exec (c:\projects\my-bot\node_modules\mware\index.js:50:23)
    at Function.run (c:\projects\my-bot\node_modules\mware\index.js:63:7)
    at Object.dispatch (c:\projects\my-bot\node_modules\botpress\lib\webpack:\src\middlewares.js:45:10)
    at Object.sendOutgoing (c:\projects\my-bot\node_modules\botpress\lib\webpack:\src\middlewares.js:159:29)
    at c:\projects\my-bot\node_modules\botpress-api.ai\bin\webpack:\src\index.js:55:43
    at process._tickCallback (internal/process/next_tick.js:109:7)
15:04:29 - warn: botpress-api.ai API Error. Could not process incoming text: Channel id format is not valid (actual: undefined, required: string)

This is because the botpress-slack is excepting a value for raw.channelId when event.bp.middlewares.sendOutgoing is called.

Issue with Api.ai in default mode

After enabling the API.AI module in default mode, I receive the following error. I'm unable to access the appended data from API.AI. This is not an issue with the wit.ai module.

error: Unhandled Rejection in Promise: Promise {
ReferenceError: shortUserId is not defined
at incomingMiddleware (/home/michael/testbot/node_modules/botpress-api.ai/bin/webpack:/src/index.js:93:25)
at exec (/home/michael/testbot/node_modules/mware/index.js:50:23)
at next (/home/michael/testbot/node_modules/mware/index.js:60:9)
at incomingMiddleware (/home/michael/testbot/node_modules/botpress-analytics/bin/webpack:/src/index.js:22:12)
at exec (/home/michael/testbot/node_modules/mware/index.js:50:23)
at next (/home/michael/testbot/node_modules/mware/index.js:60:9)
at processIncoming (/home/michael/testbot/node_modules/botpress/lib/webpack:/src/umm/index.js:203:5)
at exec (/home/michael/testbot/node_modules/mware/index.js:50:23)
at next (/home/michael/testbot/node_modules/mware/index.js:60:9)
at /home/michael/testbot/node_modules/botpress/lib/webpack:/src/listeners.js:58:9
at exec (/home/michael/testbot/node_modules/mware/index.js:50:23)
at Function.run (/home/michael/testbot/node_modules/mware/index.js:63:7)
at Object.dispatch (/home/michael/testbot/node_modules/botpress/lib/webpack:/src/middlewares.js:45:10)
at Object.sendIncoming (/home/michael/testbot/node_modules/botpress/lib/webpack:/src/middlewares.js:159:29)
at /home/michael/testbot/node_modules/botpress-messenger/bin/webpack:/src/incoming.js:152:22
at } Reason: ReferenceError: shortUserId is not defined
at incomingMiddleware (/home/michael/testbot/node_modules/botpress-api.ai/bin/webpack:/src/index.js:93:25)
at exec (/home/michael/testbot/node_modules/mware/index.js:50:23)
at next (/home/michael/testbot/node_modules/mware/index.js:60:9)
at incomingMiddleware (/home/michael/testbot/node_modules/botpress-analytics/bin/webpack:/src/index.js:22:12)
at exec (/home/michael/testbot/node_modules/mware/index.js:50:23)
at next (/home/michael/testbot/node_modules/mware/index.js:60:9)
at processIncoming (/home/michael/testbot/node_modules/botpress/lib/webpack:/src/umm/index.js:203:5)
at exec (/home/michael/testbot/node_modules/mware/index.js:50:23)
at next (/home/michael/testbot/node_modules/mware/index.js:60:9)
at /home/michael/testbot/node_modules/botpress/lib/webpack:/src/listeners.js:58:9
at exec (/home/michael/testbot/node_modules/mware/index.js:50:23)
at Function.run (/home/michael/testbot/node_modules/mware/index.js:63:7)
at Object.dispatch (/home/michael/testbot/node_modules/botpress/lib/webpack:/src/middlewares.js:45:10)
at Object.sendIncoming (/home/michael/testbot/node_modules/botpress/lib/webpack:/src/middlewares.js:159:29)
at /home/michael/testbot/node_modules/botpress-messenger/bin/webpack:/src/incoming.js:152:22
at

add support for additional fulfillment types

currently, the module only supports text

I have botkit code I use to convert api.ai fulfillment types into messenger format. It would be pretty easy to add support to convert these to UMM (see [Botpress PR 335] (botpress/botpress#335)

I just need help with the architectural design.

Below, the text fulfillment is sent to sendOutgoing

event.bp.middlewares.sendOutgoing({
type: 'text',
platform: event.platform,
text: result.fulfillment.speech,
raw: {
to: event.user.id,
message: result.fulfillment.speech,
channelId: event.platform !== 'slack' ? null : event.channel.id,
options: event.platform !== 'slack' ? null : {}
}

Assuming the {PR 335](botpress/botpress#335) is merged, how do I submit UMM messages to be sent?

botpress-api.ai API Error. Could not process incoming text: event.reply is not a function

Hello,

Installed and activated api.ai middleware right after creating a new botpress project. API.ai API-Token is correctly set. Tried with "Client access token" and "Developer access token". Mode Default and Fulfillment tried. As soon as I "Say Hi" the following error appears in console.

philipp:name-of-your-bot/ $ bp start
18:21:38 - info: Starting botpress version 1.0.8
18:21:38 - info: Loaded botpress-api.ai, version 2.0.9
18:21:38 - verbose: [UMM] Enabled for web
18:21:38 - info: Loaded botpress-web, version 1.2.3
18:21:38 - info: Loaded 2 modules
18:21:38 - debug: SKIPPING middleware: UMM.instrumentation  [Reason=disabled]
18:21:38 - debug: Loading middleware: apiai.incoming
18:21:38 - debug: Loading middleware: hear
18:21:38 - debug: Loading middleware: conversations
18:21:38 - debug: Loading middleware: web.sendMessages
18:21:38 - debug: SKIPPING middleware: UMM.instrumentation  [Reason=disabled]
18:21:38 - debug: Loading middleware: apiai.incoming
18:21:38 - debug: Loading middleware: hear
18:21:38 - debug: Loading middleware: conversations
18:21:38 - debug: Loading middleware: web.sendMessages
18:21:38 - info: Bot launched. Visit: http://localhost:3000
TypeError: event.reply is not a function
    at bp.hear (/Users/philipp/dev/node-projects/bots/name-of-your-bot/index.js:27:11)
    at /Users/philipp/dev/node-projects/bots/name-of-your-bot/node_modules/botpress/lib/webpack:/src/listeners.js:44:9
    at exec (/Users/philipp/dev/node-projects/bots/name-of-your-bot/node_modules/mware/index.js:50:23)
    at Function.run (/Users/philipp/dev/node-projects/bots/name-of-your-bot/node_modules/mware/index.js:63:7)
    at handler (/Users/philipp/dev/node-projects/bots/name-of-your-bot/node_modules/botpress/lib/webpack:/src/hear.js:8:11)
    at exec (/Users/philipp/dev/node-projects/bots/name-of-your-bot/node_modules/mware/index.js:50:23)
    at next (/Users/philipp/dev/node-projects/bots/name-of-your-bot/node_modules/mware/index.js:60:9)
    at /Users/philipp/dev/node-projects/bots/name-of-your-bot/node_modules/botpress-api.ai/bin/webpack:/src/index.js:48:9
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:169:7)
18:21:49 - warn: botpress-api.ai API Error. Could not process incoming text: event.reply is not a function
^C
philipp:name-of-your-bot/ $ node -v
v8.1.2
philipp:name-of-your-bot/ $

Typing delay in fulfillment mode

Hello!

Currently when the module is in fulfillment mode it always sends replies instantly.
It would be great if there was an option that adds a delay before sending replies (and updates the typing indicator), like typing: true in UMM.

Payload doesn't trigger custom event

I would like to use Dialogflow from a persistent menu with the default version of the module. The problem is "quick_replies: - " payload does not trigger "EXAMPLE" event in Dialogflow.

I really enjoy using Botpress, I wonder how can I help to fix this, but since I'm a newbie to programming it is not possible :(

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.