Link Search Menu Expand Document

Updated Fri Mar 5th 2021, 12:17 UTC

Assign Contact

PUT /conversations/:conversation/assign_contact

If you have multiple Contacts in your Account with the same Phone Number, it is ambiguous which Contact is having the Conversation. Assignment allows you to assign the preferred Contact to the Conversation.

Examples

User makes a request to assign the contact to the conversation

Request

PUT /conversations/Pvwqm5G/assign_contact

Body

{ "assigned_contact": "<%= contact_path(@contact) %>" }
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X PUT /conversations/Pvwqm5G/assign_contact
     -d '{json: "body"}' 

Response

Status

200

Response Type

Conversation

Example
{
  "@type": "Conversation",
  "id": "/conversations/JYnJBY",
  "@context": "/contexts/Conversation.jsonld",
  "slug": "JYnJBY",
  "currentState": "closed",
  "account": "/accounts/marks_llc",
  "requestingUserInfo": {
    "@type": "ConversationUserInfo",
    "id": "/conversations/JYnJBY/user_info",
    "@context": "/contexts/ConversationUserInfo.jsonld",
    "read": false,
    "readToTimelinePosition": null,
    "starred": false,
    "assigned": false
  },
  "phoneNumber": "+13035551234",
  "formattedPhoneNumber": "(303) 555-1234",
  "assignedContact": {
    "@type": "Contact",
    "@context": "/contexts/Contact.jsonld",
    "id": "/contacts/DQeeO69",
    "name": "TextUs Contact",
    "firstName": "TextUs",
    "lastName": "Contact",
    "phones": {
      "@type": "ConversationCollection",
      "@context": "/contexts/ConversationCollection.jsonld",
      "id": "/contacts/DQeeO69/phones",
      "members": [
        {
          "@type": "ContactPhone",
          "@context": "/contexts/ContactPhone.jsonld",
          "id": "/contact_phones/mxvbRw",
          "phoneNumber": "+13035551234",
          "formattedPhoneNumber": "(303) 555-1234",
          "extension": null,
          "type": "Mobile",
          "deliverabilityStatus": "unknown",
          "contact": "/contacts/DQeeO69"
        },
        {
          "@type": "ContactPhone",
          "@context": "/contexts/ContactPhone.jsonld",
          "id": "/contact_phones/KMrEB8w",
          "phoneNumber": "+13035555678",
          "formattedPhoneNumber": "(303) 555-5678",
          "extension": null,
          "type": "Mobile",
          "deliverabilityStatus": "unknown",
          "contact": "/contacts/DQeeO69"
        },
        {
          "@type": "ContactPhone",
          "@context": "/contexts/ContactPhone.jsonld",
          "id": "/contact_phones/1DwXpOq",
          "phoneNumber": "+13038675309",
          "formattedPhoneNumber": "(303) 867-5309",
          "extension": null,
          "type": "Mobile",
          "deliverabilityStatus": "unknown",
          "contact": "/contacts/DQeeO69"
        }
      ],
      "totalItems": 3
    },
    "notes": "/contacts/DQeeO69/notes",
    "conversations": "/contacts/DQeeO69/conversations",
    "data": {},
    "createdAt": "2020-01-06T21:49:58.312Z"
  },
  "associatedContacts": "/conversations/JYnJBY/associated_contacts",
  "participants": "/conversations/JYnJBY/participants",
  "assignments": "/conversations/JYnJBY/assignments",
  "reopenConversation": null,
  "closeConversation": "/conversations/JYnJBY/close",
  "readConversation": "/conversations/JYnJBY/read",
  "unreadConversation": "/conversations/JYnJBY/read",
  "starConversation": "/conversations/JYnJBY/star",
  "unstarConversation": "/conversations/JYnJBY/star",
  "blockConversation": "/conversations/Pvwqm5/block",
  "unblockConversation": null,
  "subscribeConversation": null,
  "unsubscribeConversation": "/conversations/Pvwq8zp/subscribe",
  "timeline": "/conversations/JYnJBY/timeline",
  "unanswered": false,
  "unsubscribed": false,
  "blocked": false,
  "stats": "/conversations/Pvwqm5G/stats",
  "assignContact": "/conversations/Pvwqm5G/assign_contact",
  "latestPreviewableItem": {
    "@type": "Message",
    "id": "/messages/06oyogE",
    "@context": "/contexts/Message.jsonld",
    "direction": "in",
    "body": "He once made a weeping willow laugh",
    "formattedBody": "<div>He once made a weeping willow laugh</div>",
    "deliveryState": "received",
    "displayTimestamp": "2018-07-24T20:59:32.156Z",
    "timelinePosition": "2018-07-24T20:59:32.156Z",
    "conversation": "/conversations/JYnJBY",
    "sender": null,
    "attachments": {
      "@context": "/contexts/hydra:Collection.jsonld",
      "@type": "hydra:Collection",
      "id": "/messages/joZqVWd/attachments",
      "members": [],
      "totalItems": 0
    },
    "friendlyStateDescription": "Inbound Message Received",
    "retryAllowed": false,
    "retry": null,
    "latestEventAt": "2018-07-24T20:59:32.156Z",
    "flags": []
  }
}

© 2021 TextUs