Skip to main content
POST
/
api
/
v1
/
accounts
/
{account_id}
/
conversations
/
{conversation_id}
/
messages
Create New Message
curl --request POST \
  --url https://app.chatwoot.com/api/v1/accounts/{account_id}/conversations/{conversation_id}/messages \
  --header 'Content-Type: application/json' \
  --header 'api_access_token: <api-key>' \
  --data '{
  "content": "Hello, how can I help you?",
  "message_type": "outgoing",
  "private": false,
  "content_type": "text",
  "content_attributes": {},
  "campaign_id": 1,
  "template_params": {
    "name": "purchase_receipt",
    "category": "UTILITY",
    "language": "en_US",
    "processed_params": {
      "body": {
        "1": "Visa",
        "2": "Nike",
        "3": "Bill"
      },
      "header": {
        "media_url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
        "media_type": "document"
      },
      "buttons": [
        {
          "type": "url",
          "parameter": "SSFSDFSD"
        }
      ]
    }
  }
}'
{
  "id": 123,
  "content": "<string>",
  "account_id": 123,
  "inbox_id": 123,
  "conversation_id": 123,
  "message_type": 0,
  "created_at": 123,
  "updated_at": 123,
  "private": true,
  "status": "sent",
  "source_id": "<string>",
  "content_type": "text",
  "content_attributes": {},
  "sender_type": "contact",
  "sender_id": 123,
  "external_source_ids": {},
  "additional_attributes": {},
  "processed_message_content": "<string>",
  "sentiment": {},
  "conversation": {},
  "attachment": {},
  "sender": {}
}

Authorizations

api_access_token
string
header
required

This token can be obtained by visiting the profile page or via rails console. Provides access to endpoints based on the user permissions levels. This token can be saved by an external system when user is created via API, to perform activities on behalf of the user.

Path Parameters

account_id
integer
required

The numeric ID of the account

conversation_id
integer
required

The numeric ID of the conversation

Body

application/json
content
string
required

The content of the message

Example:

"Hello, how can I help you?"

message_type
enum<string>

The type of the message

Available options:
outgoing,
incoming
Example:

"outgoing"

private
boolean

Flag to identify if it is a private note

Example:

false

content_type
enum<string>

Content type of the message

Available options:
text,
input_email,
cards,
input_select,
form,
article
Example:

"text"

content_attributes
object

Attributes based on the content type

Example:
{}
campaign_id
integer

The campaign id to which the message belongs

Example:

1

template_params
object

WhatsApp template parameters for sending structured messages

Response

Success

id
number

The ID of the message

content
string

The text content of the message

account_id
number

The ID of the account

inbox_id
number

The ID of the inbox

conversation_id
number

The ID of the conversation

message_type
enum<integer>

The type of the message

Available options:
0,
1,
2
created_at
integer

The time at which message was created

updated_at
integer

The time at which message was updated

private
boolean

The flags which shows whether the message is private or not

status
enum<string>

The status of the message

Available options:
sent,
delivered,
read,
failed
source_id
string

The source ID of the message

content_type
enum<string>

The type of the template message

Available options:
text,
input_select,
cards,
form
content_attributes
object

The content attributes for each content_type

sender_type
enum<string>

The type of the sender

Available options:
contact,
agent,
agent_bot
sender_id
number

The ID of the sender

external_source_ids
object

The external source IDs of the message

additional_attributes
object

The additional attributes of the message

processed_message_content
string

The processed message content

sentiment
object

The sentiment of the message

conversation
object

The conversation object

attachment
object

The file object attached to the image

sender
object

User/Agent/AgentBot object

I