You can send a webhook to a selected address when a lead or an operator sends a chat message. If you use this feature with Web API, then you can create a chat bot (auto responder) or record conversation history in your system.
To connect a webhook like that, please contact us via chat.
A POST request will be sent to selected address with every lead/operator message.
Message request example from a lead:
User-Agent: Dashly Webhook 1.0
Content-Type:
application/x-www-form-urlencoded
conversation: {"direction": "u2a", "conversation_closed": false, "conversation_tags": [], "type": "reply_user", "id": 78183798, "body": "ewfwfwef", "assignee": {"type": "admin", "name": "inkov", "avatar": "https://files.dashly.io/avatars/default-v2.png", "id": 111}, "sent_via": "web_user", "created": 1492604036, "random_id": 132466821, "conversation": 64558819, "from": 85648207}
type: conversation
token: xxx
token helps you recognize that this request came from Dashly;
type is always equal to "conversation";
"conversation" contains the "ConversationPart" object.
You can create an auto-response system (chat bot) via webhooks.
When you send a webhook like that in POST parameters, a lead's message is checked via dictionary and replied to via Web API.
Here is an example in python 2.7:
# -*- coding: utf-8 -*-
import json
import re
import requests
Â
TOKEN = ' xxx '//application token can be generated in Settings-> API keys
QUESTIONS = [{'question':'Hello, how are you', 'answer':'Hey, great!'}] //Array which will check phrase match
Â
def run(request):
   converstation = json.loads(request['conversation'])
   converstation_body = converstation['body'].upper()
   conversation_id = str(converstation['conversation'])
Â
   for element in QUESTIONS:
       exp = re.compile(r'(#\s|)(' + element['question'].upper() + ')')
       if exp.search(converstation_body):
               param = {"body": element['answer']}
               response = requests.post('https://api.dashly.io/v1/conversations/%d/reply?auth_token=%s' % (conversation_id, TOKEN), data=param)