# Send message as user

Send messages on chat on behalf of your users. Depending on your needs, you can create new conversations for your users or add messages to the existing conversations. In case of mismatching user_id with conversation id, the message won't be sent and a proper response will appear.

POST ​/message​/send_message_as_user​/

Attributes Type Required Description
conversation integer no A unique identifier for the conversation which is given by User.com (when conversation id is not provided - the request will create new converstaion for the user specified by user_id or user_custom_id).
* conversation is required if in the same payload "state" key is used.
user_id integer yes A unique identifier for the user which is given by User.com automatically.
user_custom_id string yes The unique identifier for the user which is provided by the client.
content string yes Content of a message.
state string no Conversation status. You can choose between: 'snoozed', 'close' and 'active'.
More information about converstaions might be found in the Knowledge Base.
snoozed_to date no Required if the 'snoozed' state is chosen.
source integer no A source of your message (1 - chat, 2 - email, 3 - API, 4 - SMS, 5 - Slack).

# Request

  • CURL
  • JavaScript
  • PHP
  • Python
curl --location --request POST 'https://<your_app_subdomain>.user.com/api/public/message/send_message_as_user/' \
--header 'accept: application/json' \
--header 'Accept: */*; version=2' \
--header 'authorization: Token <your_64_char_api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "conversation": 1,
    "content": "Message sent using API",
    "user_id": 926,
    "state": "active"
}'

# Response

201 created