Reply in a conversation

This method allows you to reply in a conversation and add internal notes.

URL

POST https://api.dashly.app/v1/conversations/{id}/reply

The ID of the conversation should be used as {id}.

Arguments

This method follows the general rules. Arguments are transmitted as GET or POST parameters.

Argument Description
auth_token Required. Authorization token (requires scope: conversations-write)
body Required. Body of the message.
from_user Set true if sent on behalf of user. Requires scope as-user.
from_admin Set the administrator ID<!-- if sent on behalf of the administrator (not the bot). You can set default_admin - default administrator
bot_name Set the name of the bot from which the message is sent. Default name is Bot.-->
type Message types: reply_admin or note. Default: reply_admin. Ignore if sent on behalf of the user.
random_id Random ConversationPart ID for sending control. Default: 0
auto_assign Administrator’s ID. Auto-assign administrator with this ID before message is sent
auto_assign_random_id Random ConversationPart assignment ID for sending control. Default: 0

Use from_admin and from_user to specify the sender.

Set type to specify message type (regular message or internal note).

Specify admin’s ID in auto_assign field to auto-assign him to the conversation before message is sent.

random_id and auto_assign_random_id are used for sending control. You can specify a random 32-bit number which will be returned into random_id field if you’re listening to the conversation_reply.{app_id} channel through real-time services.

Case: You’re sending a message and listening to the conversation_reply.{app_id} channel through real-time services. Once a user has sent a message, you immediately display it on the screen. The same message comes through real-time services. In order not to show this message twice, you compare the random_id from the incoming message with what you already sent, and if they match, then this is the same message and you should not display it again.

Example

<!--Reply on behalf of bot:

curl -X POST \
  --data-urlencode "body=Some Bot Message" \
  --data-urlencode "auth_token=XXX" \
  https://api.dashly.app/v1/conversations/1789152/reply

--> Reply on behalf of administrator (administrator’s ID is 8164):

curl -X POST \
  --data-urlencode "body=Some Admin Message" \
  --data-urlencode "from_admin=8164" \
  --data-urlencode "auth_token=XXX" \
  https://api.dashly.app/v1/conversations/1789152/reply

Reply on behalf of visitor to the site:

curl -X POST \
  --data-urlencode "body=Some User Message" \
  --data-urlencode "from_user=true" \
  --data-urlencode "auth_token=XXX" \
  https://api.dashly.app/v1/conversations/1789152/reply

Add inner note on behalf of administrator (administrator’s ID is 8164):

curl -X POST \
  --data-urlencode "body=Some Admin Message" \
  --data-urlencode "from_admin=8164" \
  --data-urlencode "type=note" \
  --data-urlencode "auth_token=XXX" \
  https://api.dashly.app/v1/conversations/1789152/reply

Answer

{
  "data": {
    "id": 48719451,
    "id_assign_part": 48719450
  },
  "meta": {
    "status": 200
  }
}

Answer will contain a new ConversationPart ID in id.

In case the message was auto-assigned, id_assign_part will contain corresponding ConversationPart id.