botpress-dialog
Official Dialog module for Botpress. Uses dialog-node behind the scenes.
Examples
Installation
$ botpress install dialog
Get Started
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
Usage
Once the module is installed and configured, every incoming and outgoing messages will be tracked by Dialog.
Advanced
Advanced instrumentation is exposed via the bp.dialog
object. The following methods are available:
Events
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
bpdialogevent'subscribed' 'interlocutorDistinctId' custom: 'value'
Clicks
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
bpdialoglink'http://example.com' interlocutorDistinctId// https://api.dialoganalytics.com/v1/b/7928374/clicks/?id=123456&url=http%3A%2F%2Fexample.com
Attach
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:
bpdialogbpdialog // equivalent
This will modify the track
payload:
message: name: "welcome" ... conversation: ... creator: ...