Reply to a conversation

Example Request & Response (Contact Reply)

$ curl 'https://api.intercom.io/conversations/{id/last}/reply' \
-X POST \
-H 'Authorization:Bearer <Your access token>' \
-H 'Accept:application/json' \
-H 'Content-Type:application/json' -d 

{
  "message_type": "comment",
  "type": "user",
  "intercom_user_id": "536e564f316c83104c000020",
  "body": "Thanks again :)"
}
{
    "type": "conversation",
    "id": "1911149811",
    "created_at": 1539897198,
    "updated_at": 1540393270,
    "source": {
        "attachments": [],
        "author": {
            "id": "5bc8f7421ae2d96695c18a",
            "type": "lead"
        },
        "body": "<p>Hi</p>",
        "delivered_as": "customer_initiated",
        "id": "269650473",
        "subject": "",
        "type": "conversation",
        "url": "https://intercom-survey-app.glitch.me/"
    },
    "contacts": [
        {
            "id": "5bc8f7ae2d96695c18a",
            "type": "lead"
        }
    ],
    "teammates": [
        {
            "id": "814860",
            "type": "admin",
          	"name": "Mark Strong",
          	"email": "mk@acmeinc.org"
        }
    ],
    "assignee": {
        {
            "id": "814860",
            "type": "admin",
          	"name": "Mark Strong",
          	"email": "mk@acmeinc.org"
        }
    },
    "open": true,
    "state": "open",
    "read": true,
    "waiting_since": 64654125776
    "snoozed_until": null,
    "tags": {
        "tags": [],
        "type": "tag.list",
    },
    "first_contact_reply": {
    	"created_at": 1539897198
    	"type": "conversation",
    	"url": "https://intercom-survey-app.glitch.me/"
    },
    "priority": "not_priority",
    "sla_applied": {
    	"sla_name": "VIP customer <5m",
      "sla_status": "missed",
    },
    "conversation_rating": {
        "created_at": null,
        "contact": {
            "id": null,
            "type": null
        },
        "rating": null,
        "remark": null,
        "teammate": {
            "id": null,
            "type": null,
            "name": null,
            "email": null
        }
    },
    "statistics": {
      "time_to_assignment": 2310,
      "time_to_admin_reply": 2408,
      "time_to_first_close": 4915 ,
      "time_to_last_close": 5125,
      "median_time_to_reply": 321,
      "first_contacat_reply_at": 1539897200,
      "first_assignment_at": 1539897200,
      "first_admin_reply_at": 1539897200,
      "first_close_at": 1539897200,
      "last_assignment_at": 1539897200,
      "last_assignment_admin_reply_at": 1539897200,
      "last_contact_reply_at": 1539897200,
      "last_admin_reply_at": 1539897200,
      "last_close_at": 1539897200,
      "last_closed_by": {
      	"type": "admin",
        "id": "325432652",
        "name": "Tom Smith",
        "email": "tom@example.com"
      },
      "count_reopens": 3,
      "count_assignments": 2,
      "count_conversation_parts": 67
    },  
}
#Reply without attachment
intercom.conversations.reply(:id => conversation.id, :type => 'user', 
  :email => 'bob@example.com', :message_type => 'comment', :body => 'foo')

#Reply with attachment
intercom.conversations.reply(:id => conversation.id, :type => 'user', 
  :email => 'bob@example.com', :message_type => 'comment', 
  :body => 'foo', :attachment_urls => ["http://www.example.com/attachment.jpg"])
<?php
//Reply without attachment
$intercom->conversations->replyToConversation("10957850396", [
    "intercom_user_id" => "5977303470ab497b1babb9ef",
    "body" => "Thinking: the talking of the soul with itself",
    "type" => "user",
    "message_type" => "comment"
]);


//Reply with attachment
$intercom->conversations->replyToConversation("10957850396", [
  "intercom_user_id" => "5977303470ab497b1babb9ef",
  "body" => "Thinking: the talking of the soul with itself",
  "type" => "user",
  "message_type" => "comment",
  "attachment_urls" => ["http://www.example.com/attachment.jpg"]
]);
?>
User user = new User().setId("5310d8e8598c9a0b24000005");
UserReply userReply = new UserReply(user);
userReply.setBody("Mighty fine shindig");

Conversation.reply("66", userReply);

Admin admin = new Admin().setId("1");
AdminReply adminReply = new AdminReply(admin);
adminReply.setBody("These apples are healthsome");

Conversation.reply("66", adminReply);

Example Request & Response (Admin Reply - Note)

$ curl 'https://api.intercom.io/conversations/{id/last}/reply' \\-X POST \\-H 'Authorization: Bearer <Your access token>' \\-H 'Accept: application/json' \\-H 'Content-Type: application/json' -d{  \"message_type\": \"note\",  \"type\": \"admin\",  \"intercom_user_id\": \"536e564f316c83104c000020\",  \"admin_id\": \"814860\",  \"body\": \"<html> <body>  <h2>An Unordered HTML List</h2>  <ul>   <li>Coffee</li>   <li>Tea</li>   <li>Milk</li> </ul>    <h2>An Ordered HTML List</h2>  <ol>   <li>Coffee</li>   <li>Tea</li>   <li>Milk</li> </ol>   </body> </html>\",}

You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins.

Request Path Parameters

ParameterTypeRequired?Description
idStringYes, if not lastThe identifier for the conversation as given by Intercom.
lastStringYes, if no idYou can also reply to the most recent conversation for a user by specifying last as the string.

Request Body Parameters

For a reply sent on behalf a contact:

ParameterTypeRequired?Description
message_typeStringYesAlways comment.
typeStringYesAlways user.
bodyStringYesThe text body of the comment.
intercom_user_idStringYes, if no user_id or emailThe identifier for the contact as given by Intercom.
user_idStringYes, if no intercom_user_id or emailThe external_id you have defined for the contact.
emailStringYes, if no intercom_user_id or user_idThe email you have defined for the user.
attachment_urlsArray of StringsNoA list of image URLs that will be added as attachments. You can include up to 5 URLs.

For a reply sent on behalf of an admin:

ArgumentTypeRequired?Description
message_typeStringYesAccepts comment or note.
typeStringYesAlways admin.
admin_idStringYesThe id of the admin who is authoring the comment.
bodyStringYesThe text body of the reply. Notes accept some HTML formatting.
intercom_user_idStringYes, if using the last request path and no user_id or emailThe identifier for the contact as given by Intercom.
user_idStringYes, if using the last request path and no intercom_user_id or emailThe external_id you have defined for the contact.
emailStringYes, if using the last request path and no intercom_user_id or user_idThe email you have defined for the user.
attachment_urlsArray of StringsNoA list of URLs of files that will be added as attachments. You can include up to 5 attachments.

Response

This will return the Conversation which was replied to.