Skip to main content

Quick Replies Template

Quick replies provide a way to present a set of up to 11 buttons in-conversation that contain a title and optional image, and appear prominently above the composer.

Request URI#

https://<DIYALOG-SERVER-API-ENDPOINT>/v1/bots/sendmessage/<YOUR-BOT-ACCESS-TOKEN>

Example Request#

curl -X POST -H "Content-Type: application/json" -d '{
"recipient": {
"appCustomerId": "1231232"
},
"message": {
"messageId": "messageId-1",
"text" : "Do you want to continue?",
"quickReplies" : [],
"quickRepliesV2" : [
{
"contentType" : "text",
"title" : "Yes",
"payload" : "yes",
"payloadHidden" : false,
"payloadSeenByUser" :"Yes I want to contunue",
"imageUrl" : "https://diyalog.im/app/testmessage/testimages/quickreplytemplate-yes.png"
},
{
"contentType" : "text",
"title" : "Yes",
"payload" : "yes",
"payloadHidden" : false,
"payloadSeenByUser" :"No I dont",
"imageUrl" : "https://diyalog.im/app/testmessage/testimages/quickreplytemplate-no.png"
}
]
}
}' "https://<DIYALOG-SERVER-API-ENDPOINT>/v1/bots/sendmessage/<YOUR-BOT-ACCESS-TOKEN>"

Request Details#

recipient#

You can pass the user information you want to send the message to api in the recipient object.

PropertyTypeDescriptionMandatory
appCustomerIdStringCustomer id in your systemOptional
appStaffIdStringYour staff id.Optional
idStringUnique DLG user id.Optional

You can pass the the user information that will receive your message with this object. Your request should only have one of the properties that appCustomerId, appStaffId or id.

There are two unique id for a single user in the DLG platform One of them is DLG user id. This id is created randomly when user registering to the system. Besides of this id, according to the user type, one of the customer id or staff id are stored for the user in DLG.

As a result, you can use one of the customer id or staff id and DLG id in order to send message.

If you know the DLG user id, you can use it for customor or staff.

Using customer id and staff id is more applicable than using DLG user id. Because if you want to use DLG id, you should store all DLG user ids in your system.

message#

PropertyTypeDescriptionMandatory
messageIdStringThis is a unique id of your message. You should create it in your system and send it to api. If you don't create and sent it to api DLG will create it for you and send it to you in the response of your request. DLG platfrom will feed the events of the messages to your system by this id. You can use it to differenciate events by this id. Therefore, this id is important for following all events of your message by your system.Optional
textStringText that will send to your user.Yes
quickRepliesArray<quickReply>This field is the old version, but since it is mandatory, it should be added to all requests as empty array like "quickReplies": [] .Yes
quickRepliesV2Array<quickReplyV2>The array of quick reply buttons. You should add quickReplyV2 object for each quick reply button that you want to add.Yes

quickReply#

This is the old version of the quick reply button object. It has to be set as empty array ("quickReplies" : []).

quickReplyV2#

This is the new version of quick reply button object. It defines the quick reply button properties and behavior.

PropertyTypeDescriptionMandatory
contentTypeStringThis property should be set as "text".Yes
titleStringIt is the title of the button.Yes
payloadStringThe value of this property will turn bact to your application when pressed this button by user.Yes
payloadHiddenBooleanThe value of this field can be true or false. The default value of it is false. If it set as true, value of the payload will be signed in the user's mobile device by the key of your company before turn back to you. By this way you can be sure about the valid user pressed the button. For checking the signed payload is true or not, you should know the keys that used in signing payload in the mobile device.Optional
payloadSeenByUserStringThe value of this property will be displayed in the chat screen of the user when pressed the button. If it does not set, the value of the payload will be displayed in the chat screen.Optional
imageUrlStringYou can set icon image to the button by setting this property. You can set uri address of the button of the icon to it.Optional

Response#

Successful API requests return the json object with the answer code http-2XX.

Sample response

{
"recipient_id": "2074022437",
"message_id": "-7523925115459309081"
}