Chat Widget
Returns the JavaScript code needed to embed the chat widget on a website
JavaScript code
GET /v1/scripts/chat-widget.js HTTP/1.1
Host: api.dmchamp.com
Accept: */*
JavaScript code for chat widget
text
Returns the configuration for the chat widget
ID of the chat widget configuration
GET /v1/chat-widget-config HTTP/1.1
Host: api.dmchamp.com
Accept: */*
{
"success": true,
"data": {}
}
Returns the HTML for the chat widget with the specified configuration
ID of the chat widget configuration
HTML content
GET /v1/chat-widget/{configId} HTTP/1.1
Host: api.dmchamp.com
Accept: */*
text
Returns the HTML for the chat widget with the specified configuration and from ID
ID of the chat widget configuration
ID of the source (for tracking purposes)
HTML content
GET /v1/chat-widget/{configId}/{fromId} HTTP/1.1
Host: api.dmchamp.com
Accept: */*
text
Processes an incoming message from the chat widget and publishes it to a PubSub topic
ID of the user/owner to whom the chat widget belongs
Type of message (e.g., text, reaction)
text
POST /v1/incoming-chat-widget-message HTTP/1.1
Host: api.dmchamp.com
Content-Type: application/json
Accept: */*
Content-Length: 152
{
"customData": {
"messageSid": "msg123",
"fromId": "visitor123",
"toId": "widget456",
"body": "Hello from chat widget",
"status": "received"
},
"messageType": "text"
}
{
"success": true,
"messageId": "1234567890"
}
Retrieves messages for a specific chat widget conversation
ID of the user/owner of the contact
ID of the chat widget that the contact is using
Optional timestamp (in milliseconds) to fetch only messages after this time
GET /v1/chat-widget-messages HTTP/1.1
Host: api.dmchamp.com
Accept: */*
{
"messages": [
{
"messageSid": "msg123abc",
"body": "Hello there, how can I help you?",
"mediaUrl": null,
"mediaContentType": null,
"timestamp": "2023-05-15T14:30:45.123Z",
"type": "text",
"direction": "outbound",
"status": "delivered"
},
{
"messageSid": "msg456def",
"body": "I have a question about your services",
"mediaUrl": null,
"mediaContentType": null,
"timestamp": "2023-05-15T14:30:15.456Z",
"type": "text",
"direction": "inbound",
"status": "delivered"
}
],
"isBotTyping": false
}
Updates the read status of all unread messages for a specific chat widget conversation
ID of the user/owner of the contact
ID of the chat widget that the contact is using
POST /v1/update-message-read-status HTTP/1.1
Host: api.dmchamp.com
Content-Type: application/json
Accept: */*
Content-Length: 39
{
"fromId": "user123",
"toId": "widget456"
}
{
"success": true
}
Was this helpful?