Sending message automatically on events

Hello

Wondering if we can use botpress on some channels (messenger, telegram, …) To send message when an server Event occurs.

Exemple:

  • i want To send a message to a user, when his package have bien delivered To his adresse.

  • i want to send a message if à drivers exceeds à speed limite.

  • i want to send a message if à user netflix subscription has ended.

And so on.

Best

Hey @Namec ,

Unfortunately, there is no API endpoint in Botpress that allows you to send messages to any channel of your choice.

However, you could in theory create a custom module that would expose an API endpoint to which you could send incoming messages. That module would then relay the incoming message to the proper Botpress module (FB messenger, Telegram, etc) based on the params sent to your API. You can use the Botpress SDK’s [sendEvent](https://botpress.io/reference/modules/_botpress_sdk_.events.html#sendevent) function to create the outgoing event to the channel of your choice.

Hope this helps!

1 Like

This is really a good approche, i’ll try this.

Thank you for your help

@Namec Actually you don’t need to create a module, you can create an on_server_start hook and create your endpoint. There’s an example that you can use in the code editor.

Then you can just call the endpoint and generate your event

1 Like

hello…Please let me know if this was successful