Send a chat message

Sends a real message into an existing chat thread (LinkedIn, WhatsApp, etc.). This delivers a real message as a side effect. When delivering a saved draft, pass both draftMessageId and its opaque draftRevision so a newer edit cannot be consumed. The id may also be a conversation that exists only as a saved draft; the chat is then started with the draft's recipients. Each draft revision is sent at most once: repeating the request returns the first result with repeated true and sends nothing. A draft that cannot be sent answers 409 conflict, sends nothing and names the reason in customCode: draftChanged when the draft was saved again after this draftRevision; draftTargetMismatch when the draft belongs to another conversation or account; draftSendInProgress while an earlier send of this draft is still running, which counts as draftSendOutcomeUnknown after five minutes; draftSendOutcomeUnknown when an earlier send could not be confirmed and may have been delivered, so the draft is sent again only after an edit changes its content; draftAlreadySent when this draft was already sent and the request carries other content or another draftRevision. An unknown thread answers 404 not_found, and a draft that no longer exists and was never sent answers 404 with customCode draftMessageNotFound.

POST
/v1/messaging/threads/{id}/messages

Authorization

apiKeyAuth
x-api-key<token>

API key authentication. Create an API key in your user profile and include it in the x-api-key header.

In: header

Path Parameters

id*string
Match^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://customermates.com/api/v1/messaging/threads/497f6eca-6276-4993-bfeb-53cbbbba6f08/messages" \  -H "Content-Type: application/json" \  -d '{    "text": "string"  }'
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "messagingThreadId": "ea642f89-7688-4a10-9525-46b6c79cc287",
  "connectedAccountId": "ac03972a-5ca5-43c5-b96f-c519ac843b7a",
  "providerMessageId": "string",
  "provider": "google",
  "direction": "inbound",
  "sender": {
    "attendeeId": "string",
    "displayName": "string",
    "identifier": "string",
    "pictureUrl": "string",
    "profileUrl": "string",
    "headline": "string",
    "occupation": "string",
    "isSelf": true,
    "records": []
  },
  "recipients": {
    "to": [],
    "cc": [],
    "bcc": []
  },
  "subject": "string",
  "bodyText": "string",
  "bodyHtml": "string",
  "attachmentsMeta": [
    {
      "id": "string",
      "name": "string",
      "fileName": "string",
      "type": "string",
      "mime": "string",
      "size": 9007199254740991,
      "sticker": true,
      "voiceNote": true,
      "gif": true,
      "durationSeconds": 0,
      "unavailable": true,
      "linkUrl": "string"
    }
  ],
  "isEvent": false,
  "isDeleted": false,
  "isHidden": false,
  "isDraft": false,
  "sentAt": "string",
  "editedAt": "string",
  "reactions": [],
  "folderIds": [],
  "draftRevision": "2019-08-24T14:15:22Z",
  "repeated": true
}
{
  "messageId": "8540d774-4863-4d2b-b788-4ecb19412e85",
  "threadId": "51f72284-0555-48fe-a20a-4369ee94dc3e",
  "providerMessageId": "string",
  "repeated": true,
  "sent": true
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
Empty