botpress / messaging Goto Github PK
View Code? Open in Web Editor NEWBotpress messaging server
Botpress messaging server
We have an issue when running E2E and security tests with the latest version of ts-jest (27.1.3 - kulshekhar/ts-jest@v27.1.2...v27.1.3)
See this run for the error message.
Current behaviour : you can enable / disable channel configuration
Suggestion : a developer could simply remove the config if it's desired to be removed
Botpress core version: 12.26.3
All though titles are not required for other channels when using the image content-type, if you don`t provide, it will not work in the Slack Channel and an error will be thrown:
[ERROR] web-api:WebClient:0 failed to match all allowed schemas [json-pointer:/blocks/0/title]
[ERROR] web-api:WebClient:0 missing required field: text [json-pointer:/blocks/0/title]
09/28/2021 14:20:49.466 [Messaging] app:slack Error occurred when sending a message. Error: An API error occurred: invalid_blocks
at Object.platformErrorFromResult (C:\snapshot\messaging\node_modules@slack\web-api\dist\errors.js:51:33)
at WebClient.apiCall (C:\snapshot\messaging\node_modules@slack\web-api\dist\WebClient.js:156:28)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async SlackCommonSender.send (C:\snapshot\messaging\packages\server\dist\channels\slack\senders\common.js)
at async SlackConduit.sendToEndpoint (C:\snapshot\messaging\packages\server\dist\channels\base\conduit.js)
at async InstanceService.sendMessageToInstance (C:\snapshot\messaging\packages\server\dist\instances\service.js)
{
to fix this you need to specify a title:
Since titles are not required by the content type, I believe the renderer should auto-generate one.
When you don't follow the "happy path", it's incredibly hard to get messaging to work.
It should work correctly. Right now, it fails because the bot ID must be unique, but it shouldn't be the case in the future.
If you create a bot on a server, then remove messaging.id / messaging.token, and restart the server, it will receive a new id / token combination, but it doesn't seems to update the messaging database, because the bot doesn't work anymore.
If you export a bot, delete it, clear the id/token and re-import the bot with the same name, it will fail
Follow up on botpress/v12#370
As this now has its own project, I would like to request support for the creation of a Mattermost plugin.
I understand this might be low priority for the Botpress Team, but maybe you could reference documentation or a tutorial to support a contribution for Mattermost and similar messaging vendors?
v12.26.1
I was trying to use the voice composer after activating the google speech module, and I face the below issue in the logs:
09/13/2021 23:03:35.996 Mod[channel-web] [test]
HTTP (post) URL /media
Received "This type of file is not allowed: audio/webm"
Request failed with status code 400
I just realized that there's no trace of the messaging client in the diagnostic report, this might be useful to investigate weird issues or race conditions. We just had an issue where there were some "rogue processes" and this could have helped.
Also, can you add a name to the redis connection, with a similar naming than the other processes? The master process of the orchestrator generates an ID (process.env.SERVER_ID) which can help us associate processes together.
Having those information help us pinpoint the problem more easily
WhatsApp
now supports interactive messages (buttons
)!
This should be supported rather than resorting to the old way of sending the options in as a text message.
https://developers.facebook.com/docs/whatsapp/guides/interactive-messages
I got this error message and had to spend some time to find the issue.
Somehow I had 2 different configurations:
When validating the schema using Joi, please consider setting the option "ignore unknown properties" instead of rejecting the payload completely. The correct fields were also present, so the bot would have worked properly.
I have configured a new app in the facebook developers account and it forces me to use v15.0 API. But botpress is using v12.6. How can I upgrade my code to use the v15.0. While using the v12.6 graph API it gives the error 400 Bad request
:
{
"error": {
"message": "Unknown path components: /me/messages",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "Ay0lBm-yBJucULHbD0R5QdZ"
}
}
There is already an issue opened for the database schema, but can you make a schema like the event engine, explaining the layers and paths that a message will follow through messaging? Something like the event engine (https://botpress.com/docs/main/overview) would be amazing.
You can use draw.io to make such a schema. For example, here's the xml schema for the event engine:
Can anyone update https://github.com/botpress/messaging for dummies like this tutorial: https://github.com/botpress/botpress/discussions/12393 I can add to that page how to install the messages module and activate etc.
I have also read https://v12.botpress.com/messaging-channels/direct-integrations/facebook-messenger it does not tell you how to install the module in a way i can understand.
Hi, i am trying to build the messaging server binaries, to test with the botpress docker image.
Thanks in advance.
I know that repositories should have more autonomy, but they should still be able to be built together with all other repositories. I don't think we have a lot of clients who are able to install multiple versions of nodejs on their development computer just because we have different requirements.
I am simply unable to build everything without messing around with node versions (.nvmrc is not supported on windows). Therefore, It makes more sense to stick to the same node version for all related repositories.
Either you find a way to scale down the version requirement of messaging to the version we use everywhere else (including the builtin server in the binary), or you find a way to update the version in each repositories at the same time (including related tests).
At first glance, the module eslint-plugins-jsdoc
version 36 requires a higher node version, is there any reason for that ? Can't we simply use the same version we have everywhere else and skip this requirement?
Apart from that, there is also an higher requirement for "parcel". What is this package used for? If it's for frontend, why not using webpack like every other repositories we have ?
Having independence over the codebase doesn't mean that you have to reinvent the wheel and to make things incompatible between other codebases, we should be able to work seamless between workspaces
Hello everyone,
I'm trying to start developing a custom channel based on the custom-channel repo and from what I can understand I need to get this working locally so I can connect my custom channel and start building, but I'm having some issues making it work.
First, I don't not if it's an issue of the documentation but I couldn't start the services using Tilt the way it's documented - had to run a yarn install
first (which sounds logic but maybe the step should be explicitly mentioned?)
This yarn install gives me some warnings about dependencies not satisfied, but after it Tilt can start the resources successfully:
❯ yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @botpress/messaging-board@workspace:packages/board doesn't provide @parcel/core (p8ec10), requested by @parcel/config-default
➤ YN0002: │ @botpress/messaging-components@workspace:packages/components doesn't provide babel-loader (p6cd3a), requested by @storybook/addon-essentials
➤ YN0002: │ @botpress/messaging-components@workspace:packages/components [d721a] doesn't provide babel-loader (p7a0bc), requested by @storybook/addon-essentials
➤ YN0002: │ @botpress/messaging-server@workspace:packages/server doesn't provide @opentelemetry/api (pc6b23), requested by @opentelemetry/instrumentation-aws-sdk
➤ YN0002: │ @botpress/messaging-server@workspace:packages/server doesn't provide @opentelemetry/api (p07603), requested by @opentelemetry/instrumentation-express
➤ YN0002: │ @botpress/messaging-server@workspace:packages/server doesn't provide @opentelemetry/api (p1080b), requested by @opentelemetry/instrumentation-http
➤ YN0002: │ @botpress/messaging-server@workspace:packages/server doesn't provide @opentelemetry/api (p6bb08), requested by @opentelemetry/instrumentation-ioredis
➤ YN0002: │ @botpress/messaging-server@workspace:packages/server doesn't provide @opentelemetry/api (p6bef0), requested by @opentelemetry/instrumentation-knex
➤ YN0002: │ @botpress/messaging-server@workspace:packages/server doesn't provide @opentelemetry/api (p2e0b5), requested by @opentelemetry/instrumentation-pg
➤ YN0002: │ @botpress/messaging-server@workspace:packages/server doesn't provide prom-client (p34f6f), requested by @promster/types
➤ YN0002: │ @botpress/webchat-inject@workspace:packages/inject doesn't provide @parcel/core (p5db79), requested by @parcel/config-default
➤ YN0002: │ @botpress/webchat-inject@workspace:packages/inject doesn't provide typescript (pb00c9), requested by @parcel/transformer-typescript-tsc
➤ YN0060: │ @botpress/webchat@workspace:packages/webchat provides mime (p5bc44) with version 3.0.0, which doesn't satisfy what @botpress/messaging-components requests
➤ YN0060: │ @botpress/webchat@workspace:packages/webchat provides react (p33191) with version 17.0.2, which doesn't satisfy what @botpress/messaging-components and some of its descendants request
➤ YN0060: │ @botpress/webchat@workspace:packages/webchat provides react (p4b3ac) with version 17.0.2, which doesn't satisfy what mobx-react and some of its descendants request
➤ YN0060: │ @botpress/webchat@workspace:packages/webchat provides react (p61e8a) with version 17.0.2, which doesn't satisfy what react-ga requests
➤ YN0060: │ @botpress/webchat@workspace:packages/webchat provides react (p18844) with version 17.0.2, which doesn't satisfy what react-intl requests
➤ YN0060: │ @botpress/webchat@workspace:packages/webchat provides react-dom (p50820) with version 17.0.2, which doesn't satisfy what @botpress/messaging-components and some of its descendants request
➤ YN0060: │ @bpinternal/trail@npm:0.1.0 provides @opentelemetry/api (pa21f3) with version 1.1.0, which doesn't satisfy what @opentelemetry/auto-instrumentations-node and some of its descendants request
➤ YN0002: │ @mdx-js/loader@npm:1.6.22 doesn't provide react (p12550), requested by @mdx-js/react
➤ YN0002: │ @parcel/optimizer-image@npm:2.2.1 doesn't provide @parcel/core (p48c9f), requested by @parcel/workers
➤ YN0002: │ @parcel/reporter-dev-server@npm:2.2.1 doesn't provide @types/express (p57ed2), requested by http-proxy-middleware
➤ YN0002: │ @parcel/transformer-image@npm:2.2.1 doesn't provide @parcel/core (p7bfaa), requested by @parcel/workers
➤ YN0002: │ @parcel/transformer-js@npm:2.2.1 doesn't provide @parcel/core (pe40b6), requested by @parcel/workers
➤ YN0002: │ @parcel/transformer-postcss@npm:2.2.1 doesn't provide postcss (p0b5da), requested by postcss-modules
➤ YN0002: │ @parcel/types@npm:2.2.1 doesn't provide @parcel/core (pfd728), requested by @parcel/fs
➤ YN0002: │ @parcel/types@npm:2.2.1 doesn't provide @parcel/core (p9b3cc), requested by @parcel/workers
➤ YN0002: │ @parcel/types@npm:2.2.1 doesn't provide @parcel/core (pe2210), requested by @parcel/cache
➤ YN0002: │ @parcel/types@npm:2.2.1 doesn't provide @parcel/core (p7a308), requested by @parcel/package-manager
➤ YN0002: │ @promster/express@npm:7.0.5 doesn't provide prom-client (pf18c2), requested by @promster/metrics
➤ YN0002: │ @promster/metrics@npm:9.1.5 [45095] doesn't provide typescript (pcf955), requested by ts-essentials
➤ YN0002: │ @promster/metrics@npm:9.1.5 [471c6] doesn't provide typescript (p7c2a9), requested by ts-essentials
➤ YN0002: │ @promster/server@npm:7.0.7 doesn't provide prom-client (p399ec), requested by @promster/metrics
➤ YN0002: │ @vonage/server-sdk@npm:2.10.7-beta-2 doesn't provide @babel/core (p3f8da), requested by @babel/eslint-parser
➤ YN0002: │ @vonage/server-sdk@npm:2.10.7-beta-2 doesn't provide eslint (pf6ac9), requested by @babel/eslint-parser
➤ YN0002: │ @vonage/server-sdk@npm:2.10.7-beta-2 doesn't provide eslint (pe1fde), requested by @babel/eslint-plugin
➤ YN0002: │ sunshine-conversations-client@npm:9.5.9 doesn't provide @babel/core (pf0dc1), requested by @babel/cli
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 649ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 1s 381ms
➤ YN0000: ┌ Link step
➤ YN0005: │ core-js@npm:3.20.0 lists build scripts, but its build has been explicitly disabled through configuration.
➤ YN0005: │ core-js-pure@npm:3.20.0 lists build scripts, but its build has been explicitly disabled through configuration.
➤ YN0000: └ Completed in 1s 848ms
➤ YN0000: Done with warnings in 4s 144ms
Once I have those resources started and in "ready" status if I open the messaging resource details I can see in the logs that the server is listening:
12/01/2022 14:01:00.058 Launcher ===========================================================================
Botpress Messaging
Version 1.2.7
===========================================================================
12/01/2022 14:01:00.191 Admin ===========================================================================
ADMIN_KEY IS NOT SET
ADMIN ROUTES ARE UNPROTECTED
===========================================================================
12/01/2022 14:01:00.220 Launcher Server is listening at: http://localhost:3100/
12/01/2022 14:01:00.220 Launcher No external URL configured. Messaging Server might not behave as expected. Set the value for 'EXTERNAL_URL' to suppress this warning
But if I go to http://localhost:3100 I get this:
Also, if I try to open the webchat (which is located at http://127.0.0.1:3543/) I only see the "Example website
This website integrates the botpress webchat!" text without any webchat, and these errors on the console:
Live reload enabled.
127.0.0.1/:1 Uncaught SyntaxError: Unexpected token 'c', "connected" is not valid JSON
at JSON.parse (<anonymous>)
at ws.onmessage (runtime-79e8b212159ad102.js:109:12)
runtime-ea4cd6bdd08c17f2.js:95 WebSocket connection to 'ws://localhost:8080/' failed:
goWOo @ runtime-ea4cd6bdd08c17f2.js:95
useObserver.ts:59 [MobX] You haven't configured observer batching which might result in unexpected behavior in some cases. See more at https://github.com/mobxjs/mobx-react-lite/#observer-batching
useObserver @ useObserver.ts:59
runtime-ea4cd6bdd08c17f2.js:95 WebSocket connection to 'ws://localhost:8080/' failed:
goWOo @ runtime-ea4cd6bdd08c17f2.js:95
runtime-ea4cd6bdd08c17f2.js:171 undefined
ws.onerror @ runtime-ea4cd6bdd08c17f2.js:171
runtime-ea4cd6bdd08c17f2.js:175 [parcel] 🚨 Connection to the HMR server was lost
ws.onclose @ runtime-ea4cd6bdd08c17f2.js:175
index.4fdcc17c.js:12947 Uncaught (in promise) Client not found
The same thing happens if I drop Tilt and try to start it using yarn dev
.
Is there anything that I'm missing? If so please let me know, I'm eager to make this work and hopefully contribute to the project in the future since we may use it intensely at work.
Thanks,
Hello,
I can see checked checkbox for video
type, file
type and location
type.
on https://github.com/botpress/messaging/tree/master/packages/channels/src/telegram
But, I'm unable to receive any of these types on telegram
.
It is working as expected on web channel.
Does it need extra configuration or is it a bug?
When playing around with different configurations, I used to change the name of the channel so it wouldn't be loaded by messaging. Looks like some additional validation was added and it prevents the bot to load... do you think we can remove it ? I don't see any downside by having that, and it gives more flexibility to play around with different configurations. If messaging doesn't support an option, it could just ignore it instead of throwing an error
Describe the bug
When configuring Vonage to use the testing API (sandbox), we can easily exceed the rate limit defined by the sandbox.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The messaging server should make sure that we respect the one-second rate limiter that Vonage's testing API enforces.
Screenshots
Environment (please complete the following information):
Additional context
N/A
Currently: When we capture a user's message in the webhook we receive something like the following
{
channelId: 'asdasdas',
clientId: 'asdasd',
/*....*/
}
Then if you want to reply to that message you need to specify the channel and no where it says that we should use the channel name and not the id which can become confusing. It's also super tempting to use data.channel
.
From what I understand, channel-id is for internal usage so it shouldn't be exposed to the user
There is web_user_map
to map channel web's visitor ID to Messaging UID, and you use msg_kvs
to store channel-teams user ID to Messaging UID.
Channels each have their unique ID to identify a visitor. Each entry in msg_users
represent an association userID
- botId
, why don't you add the channel's internal ID to this table instead ?
We could also add a "metadata" field which could be used to store additional data if required.
I see absolutely no reason to have a table "msg_kvs" in this service.
I got this error message when my server restarted while discussing with the bot on slack. This log is way too long (axios traces of like 300 lines). Please just print the error message, or pick useful stuff from the axios error and only display that
On a side note, shouldn't it write [Messaging] Channel-Slack instead of "launcher" ?
So hm, if you simply change the messaging endpoint and restart the server, when you open the webchat there's a ton of endless queries. This definitely would need some sort of protection to prevent a user to ddos the service
If you create a bot with a remote endpoint and then remove it, it does the same thing locally
When using an external messaging service (not spinned by botpress), there seems to be an additional configuration which is not specified.
Okay, so hmm not sure how I managed to get there the first time, but I was able to reproduce easily:
Basically, I ended up with those errors, and an unresponsive server which needed a reboot
Not sure of the root cause (bot id validation or else).
When a bot is configured with teams with a non-working appID it crashed the messaging app and no bot can be talked to unless Botpress is restarted.
I fixed this by removing the config in the affected bot and an old global channel-teams.json file that was present on the server containing this appid.
This is happening using 12.26.10
When I speak to my bot, I get this error message continuously. I have no idea how to debug that, I tried to add LOGGING_ENABLED: true
in messaging-server
, but it didn't help.
Previously I would just add some logging in messaging source code, build it, then set DEV_MESSAGING_PATH, but it doesn't work since the migration to node 16 (which supports natively optional chaining, while 12 doesnT). How do you develop and debug currently?
On Botpress you can configure the base URL to something different than / and it looks like messaging is not taking this into account.
There are often users who changes that to /botpress, so it changes the base url of the whole server, so it would be http://localhost:3000/botpress/api/v1/chat/receive
I set up all channels on the previous version, then copied my data folder over to master, and started it. I had those issues. I couldn't test smooch because I don't have an account, but I hope it will be tested
Telegram was working fine in the previous version, but it doesn't work anymore after the migration. I don't use a standard port, but it should still work fine, can you use the same version/setup that was used by channel-telegram so the migration is seamless?
Smooch fails on the first startup after the migration and requires to be rebooted again to start working
Migrations are executed after modules are loaded, which generates a ton of error messages... Is there a better way we could handle this ?
I already had a slack bot configured with the old URL. I tried to update the domain (new one for ngrok), but I forgot to update the second bot ID in the URL. Maybe needs an additional check to handle that gracefully?
https://4b1799194b02.ngrok.io/api/v1/bots/welcome-bot/mod/channel-slack/bots/main/events-callback
(theres "welcome-bot" and "main" there). The error could be more user-friendly:
When running Messaging in standalone, we should display a warning if EXTERNAL_URL is undefined.
WhatsApp CloudAPI now is publicly available.
https://developers.facebook.com/blog/post/2022/05/19/whatsapp-cloud-based-api/
using the official meta service can reduce some third party costs..
When a user clicks a button in a single choice, the event.type sent to Botpress is 'text'.
This should be of type 'quick_reply'.
'text' should only be sent if the user wrote something instead of picking an option.
nvm. missed the logs line
There are a couple of things that I think should be addressed:
The list of channels is hardcoded in the BP repository (https://github.com/botpress/botpress/blob/sm-extmsg-7-fix-hitlnex/src/bp/core/config/config-loader.ts#L176). This list should be provided by the Messaging process. Once the messaging process is registered (https://github.com/botpress/botpress/blob/sm-extmsg-7-fix-hitlnex/src/bp/orchestrator/web-worker.ts#L61), it could query messaging to get a list of available channels, then update the botpress configuration (adding new channels to the file).
Channel configuration schemas should be moved from the main repository (in channel-*/assets/config.schema.json
and into this one.
A. There should be an endpoint on messaging that can be called to obtain this schema (to use in code editor)
B. There should also be an endpoint where you can get the default configuration from that schema (to generate the default file)
Messaging displays a lot of verbose and useless logs for the user.
A. The list of channels can be shortened to a single line. Space is wasted to display them on separate lines
B. Endpoints are all listed but usage is not clear, and even disabled channels are displayed
C. Logs should fit nicely with logs of other processes
The process of enabling and adding channels is really not clear. You need to update the botpress.config.json
file, then somehow go on the code editor to create a channel-name.json
file, and copy the config from somewhere else.
A. When you enable a channel in botpress.config.json
, there should be some process which would automatically query messaging, get the default config for that channel, and create a channel-name.json
file
Maybe we could simplify the channel creation process. We could either merge all channel-*.json
files into a single channels.json
file, or in a channels
property in the bot.config.json
file. We could even add an "environment" variable to ease development. What do you think? This would make it really easy to develop the bot once and move the archive between dev and prod
bot.config.json or channels.json
channels: {
prod: {
slack: {}
telegram: {}
}
// or
channels: [
{
name: 'slack',
enabled: true,
env: 'prod',
authToken: ''
},
{
name: 'slack',
env: 'dev',
enabled: false,
}
]
Once a channel is enabled, messaging should make a basic test to let the user know if the channel is properly configured, and it should give meaningful information to the user on how to do that.
A. When channel is enabled, display a log indicating so
B. Perform a small test to see if the channel configuration is actually correct
C. Either add a log or an endpoint that a user can query to get the complete URL required to configure the webhook on different services (ex: the full event / interactive URL required by slack)
I think we should add a "legacy" route handler on messaging, and redirect all requests done to channel-*
to the messaging process (except for channel-web). Since we removed channels from the main BP repository, all the logic (including legacy logic) should be in messaging. This will make it much easier to update channels and fix issues by having all the logic at the same place.
A. Proxy all routes channel-*
to messaging process
B. Print a warning to the user indicating that the old route is deprecated (/mod/channel-slack/events) and display the correct route
The discord channel doesn't seem to be working properly.
The problems (I think) are:
server/src/channels/discord/conduit.ts
, at line 21, you are not specifying the bot's intents, so discord isn't sending the bot any messages. Try using this.client = new Discord.Client({ intents: [Discord.Intents.FLAGS.GUILDS, Discord.Intents.FLAGS.GUILD_MESSAGES] })
after updating discord.jsdiscord-buttons
is wholly unnecessary and all the buttons can just be used via discord.jsI tried fixing this myself, but my lack of skills in node.js prevented me from doing so. If you want to see what I attempted to do, I will gladly share. The main problem I encountered was that the updated discord.js presumably uses modern javascript syntax (such as ?? and ?.) and the javascript compiler in the botpress standalone server didn't seem to like that.
I'd appreciate it if someone with more brains than I could fix this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.