Reply in a conversation

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

URL

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

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

Parameters

Authentification parameters. id_as_string parameter. Parameters, enabling ConversationPart optional fields.

Parameter Type Description
body Optional[string] Message text. Can be empty in case message contains only an attachment (for example, an image). Empty string by default
body_json Optional[Dict] json with optional message data, depending on created message type
attachment Optional[File] File attached to the message
attachment_file_name Optional[string] Name of attached file. String from 1 to 255 symbols.
from_user Optional[ID] Set default_user or specific user ID in case you're sending as a visitor
from_admin Optional[ID/default_admin] ID of admin who replies into the conversation or default_admin to reply as default admin
type Optional[string] Message type. Available types: reply_admin, note, article. Parameter is ignored when from_user is set. Default: reply_admin
external_id Optional[string] External message Id
random_id Optional[integer] random integer to validate created message with RTS message. Default: 0
auto_assign Optional[ID] Admin ID. Automatically assign set admin to this conversation
auto_assign_random_id Optional[integer] Random ConversationPart assignment ID for sending control. Default: 0
referrer Optional[string] Page URL, from which the message was received. Default: undefined

Note

Use from_admin and from_user to control the admin/user who replies into the conversation. Use type to specify message type (reply_admin - regular reply, note - only visible in admin panel, article - knowledge base article)

Specify admin ID in auto_assign to automatically assign this admin to the conversation. This will create 2 messages instead of one: assignment system message and the message itself.

random_id and auto_assign_random_id are used to validate the message, received through Realtime services. random_id is used to validate created message with Realtime services. You can use 32-bit integer, which will be returned as one of ConversationPart fields, created by tour request. You can't use conversation part ID because Realtime services is asynchronous and may receive the new message before(or after. It happens randomly as order is not set) you get response to message part creation.

Response

data contains created ConversationPart objects:

  • the main message will be returned as main data content
  • assignment message will be returned in data.assign_part (in case auto_assign is set)

Example:

{
  "data": {
    "id": "1453279698921457472",
    "created": 1685352440,
    "conversation": "1447294760057308402",
    "body": "",
    "body_json": {},
    "direction": "u2a",
    "type": "reply_user",
    "sent_via": "api",
    "attachments": [
      {
        "type": "file",
        "id": "1453279691052943108",
        "filename": "test_import.csv",
        "mime_type": "text/csv",
        "size": 156,
        "url": "https://files.dashly.app/attachments/2782/2e7cac55-dff0-4142-9460-14d64ff08623/test_import.csv",
        "created": 1685352439
      }
    ],
    "meta_data": {},
    "reply_type": "no",
    "actions": null,
    "edited": null,
    "removed": null,
    "external_id": null,
    "part_group": "1447294760216691955",
    "from": "1447294708215711734",
    "assign_part": {
      "id": "1453281238935668443",
      "created": 1685352624,
      "conversation": "1447294760057308402",
      "body": "",
      "body_json": {},
      "direction": "a2u",
      "type": "assigned",
      "sent_via": "api",
      "meta_data": {},
      "reply_type": "no",
      "actions": null,
      "edited": null,
      "removed": null,
      "external_id": null,
      "part_group": "1447294760216691955",
      "assignee": {
        "id": "30542",
        "name": "Test",
        "avatar": "https://files.dashly.app/avatars/default-v4.png",
        "type": "admin"
      },
      "from": {
        "id": "30542",
        "name": "Test",
        "avatar": "https://files.dashly.app/avatars/default-v4.png",
        "type": "admin"
      }
    }
  },
  "meta": {
    "status": 200
  }
}

Exceptions

Standart Web API exceptions

This method specific exceptions

Exception Code Description
ReplyTooBig 400 Message text too long (body)

Example

Reply from admin and assign this admin to conversation (admin ID - 8164):

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

Reply as visitor to the site:

curl -X POST \
  --data-urlencode "body=Some User Message" \
  --data-urlencode "from_user=default_user" \
  -H "Authorization: Token XXX" \
  https://api.dashly.app/conversations/1789152/reply

Add a note as admin (admin ID - 8164):

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