Official Dialog module for Botpress. Uses dialog-node behind the scenes.
$ botpress install dialog
Configure the module with your Dialog API token which is available in your personal account, and a bot ID.
Configuration can also be done programmatically by providing the settings in the file ${modules_config_dir}/botpress-dialog.json
.
Note: Please note this currently only works with botpress-messenger
Once the module is installed and configured, every incoming and outgoing messages will be tracked by Dialog.
Advanced instrumentation is exposed via the bp.dialog
object. The following methods are available:
Send events to Dialog to keep track of your custom logic. Optionally pass an Interlocutor's distinct id to tie the event to one of your bot's interlocutors. See docs.dialoganalytics.com/reference/event#create
bp.dialog.event('subscribed', 'interlocutorDistinctId', { custom: 'value' })
Record clicks by interlocutors inside a conversation using a trackable link. For every links that needs to be tracked, generate a trackable URL by passing the interlocutor's distinct Id (provided by the platform or provider) and the url
to the link
method. See docs.dialoganalytics.com/reference/click-tracking
bp.dialog.link('http://example.com', interlocutorDistinctId)
// https://api.dialoganalytics.com/v1/b/7928374/clicks/?id=123456&url=http%3A%2F%2Fexample.com
Modify the current track
payload about to be sent to Dialog's API with this helper method.
For example, you can specify a message name:
bp.dialog.attach('welcome')
bp.dialog.attach({ message: { name: 'welcome' }}) // equivalent
This will modify the track
payload:
{
message: {
name: "welcome",
...
},
conversation: { ... },
creator: { ... }
}