User Initiated Message
$ curl https://api.intercom.io/messages \
-XPOST \
-H 'Authorization:Bearer <Your access token>' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' -d'
{
"from": {
"type": "user",
"id": "536e564f316c83104c000020"
},
"body": "Hey"
}'
HTTP/1.1 200 OK
{
"type": "user_message",
"id": "2001",
"created_at": 1401917202,
"body" : "Hey, is the new thing in stock?",
"message_type": "inapp"
}
intercom.messages.create(
:from => {
:type => "user",
:id => "536e564f316c83104c000020"
},
:body => "Hey"
)
<?php
$intercom->messages->create([
"message_type" => "inapp",
"body" => "Surely, I said, knowledge is the food of the soul",
"from" => [
"type" => "user",
"id" => "5989303470da497b1babb9ef"
]
]);
?>
UserMessage userMessage = new UserMessage()
.setBody("Hey! Is there, is there a reward?")
.setUser(user);
Conversation.create(userMessage);
You can create a new user or lead initiated message by submitting a POST
to https://api.intercom.io/messages
along with a JSON message.
The sending user or lead is identified by their user_id
, email
or id
values in the from
field, along with a type
field value of user
or contact
.
The message_type
for a user initiated message is always treated as a inapp
and will appear as a conversation inside Intercom. The email
message type is not currently supported for a user initiated message.
User initiated messages can not be sent to specific admins, and as such, do not use the to
field.
Attributes
Attribute | Type | Description |
---|---|---|
body | string | The content of the message. Plaintext only, HTML is not supported. |
from | object | A user or lead object containing the user's id or user_id (or email if lead ). The type field must have a value of user or contact . |
Returns
The created message object.