This method adds a new callback.
// Callback on new conversation start
dashly.addCallback('conversation_started', function(data) {
console.log('User started conversation with ID = ' + data.id + ', message: ' + data.body)
})
Argument | Description |
---|---|
topic |
Required. Topic. In case you want to receive a notification. |
callback |
Required. Function being called. |
When callback is being called the only argument transmitted will be a data
JSON-object with additional data.
topics
should be set when a callback is being created
(topic is an exact condition a callback should be called upon):
User started a new conversation.
dashly.addCallback('conversation_started', function(data) {
// data.id - conversation ID
// data.body - message text
...
})
Chat opened (this topic also works if a small pop-up is shown to a user).
dashly.addCallback('messenger_opened', function(data) {
...
})
Chat closed.
dashly.addCallback('messenger_closed', function(data) {
...
})
User replied in a conversation
dashly.addCallback('user_replied', function(data) {
// data.id - conversation ID
// data.body - user message text
// data.message - message ID(manual or auto), in case a user replies a manual or an auto message. Else NULL.
...
})
conversation opened
dashly.addCallback('conversation_opened', function(data) {
// data.id - conversation ID
// data.message - message ID(manual or auto). Contains NULL in case it is a conversation, started by a user.
// data.type - conversation type
// data.parts - conversation parts
...
})
Event tracked
dashly.addCallback('event_tracked', function(data) {
// data.id - ID of event created
// data.event - name of event
...
})
In case those topics are not enough for your purposes,
write to us!
We like good ideas.