Create message
Individual chat messages
Body
-
The Identity of the new message's author. The default value is
system
. -
A valid JSON string that contains application-specific data.
-
The date, specified in ISO 8601 format, to assign to the resource as the date it was created. The default value is the current time set by the Chat service. This parameter should only be used when a Chat's history is being recreated from a backup/separate source.
-
The date, specified in ISO 8601 format, to assign to the resource as the date it was last updated.
-
The Identity of the User who last updated the Message, if applicable.
-
The message to send to the channel. Can be an empty string or
null
, which sets the value as an empty string. You can send structured data in the body by serializing it as a string. -
The SID of the Media to attach to the new Message.
Minimum length is
34
, maximum length is34
. Format should match the following pattern:^ME[0-9a-fA-F]{32}$
.
curl \
--request POST 'https://chat.twilio.com/v2/Services/{ServiceSid}/Channels/{ChannelSid}/Messages' \
--user "username:password" \
--header "Content-Type: application/x-www-form-urlencoded" \
--header "X-Twilio-Webhook-Enabled: true" \
--data 'Body=Hello'
{"Body"=>"Hello"}
{"Body"=>"Hello", "Attributes"=>"{\"test\": \"test\"}", "DateCreated"=>"2015-12-16T22:18:37Z", "DateUpdated"=>"2015-12-16T22:18:38Z", "LastUpdatedBy"=>"username"}
{"MediaSid"=>"MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}
{
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"body": "Hello",
"from": "system",
"type": "text",
"index": 0,
"media": null,
"attributes": null,
"was_edited": false,
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date_created": "2016-03-24T20:37:57Z",
"date_updated": "2016-03-24T20:37:57Z",
"last_updated_by": "system"
}
{
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"body": "Hello",
"from": "system",
"type": "text",
"index": 0,
"media": null,
"attributes": "{\"test\": \"test\"}",
"was_edited": true,
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date_created": "2015-12-16T22:18:37Z",
"date_updated": "2015-12-16T22:18:38Z",
"last_updated_by": "username"
}
{
"to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"body": "Hello",
"from": "system",
"type": "text",
"index": 0,
"media": {
"sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"size": 99999999999999,
"filename": "hello.pdf",
"content_type": "application/pdf"
},
"attributes": null,
"was_edited": false,
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"date_created": "2016-03-24T20:37:57Z",
"date_updated": "2016-03-24T20:37:57Z",
"last_updated_by": "system"
}