Post the necessary fields for the API to add a new inbound message. <br />
http
POST https://services.leadconnectorhq.com/conversations/messages/inboundAuthorization
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
Authorization | string | Yes | Bearer token generated from the Leadway portal. See Authentication. | |
Version | string | Yes | 2021-07-28 | API version. |
Body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
type | string | Yes | SMS | Message Type Possible values: 'SMS', 'RCS', 'Email', 'WhatsApp', 'GMB', 'IG', 'FB', 'Custom', 'WebChat', 'Live_Chat', 'Call', 'IVR_Call', 'Campaign_Call', 'Campaign_VoiceMail', 'TIKTOK', 'ALL_IN_ONE_CHAT', 'FORM_SUBMISSION' |
attachments | string[] | No | Array of attachments | |
message | string | No | Message Body | |
conversationId | string | Yes | ve9EPM428h8vShlRW1KT | Conversation Id |
contactId | string | Yes | ve9EPM428h8vShlRW1KT | Contact Id |
conversationProviderId | string | Yes | 61d6d1f9cdac7612faf80753 | Conversation Provider Id |
html | string | No | HTML Body of Email | |
subject | string | No | Subject of the Email | |
emailFrom | string | No | sender@company.com | Email address to send from. This field is associated with the contact record and cannot be dynamically changed. |
emailTo | string | No | Recipient email address. This field is associated with the contact record and cannot be dynamically changed. | |
emailCc | string[] | No | List of email address to CC | |
emailBcc | string[] | No | List of email address to BCC | |
emailMessageId | string | No | Send the email message id for which this email should be threaded. This is for replying to a specific email | |
altId | string | No | 61d6d1f9cdac7612faf80753 | external mail provider's message id |
direction | object | No | Message direction, if required can be set manually, default is outbound | |
date | string | No | Date of the inbound message | |
call | object | No | Phone call dialer and receiver information |
Responses
200 - Created the message
success(boolean, required)conversationId(string, required): Conversation ID. Example:ABC12h2F6uBrIkfXYazbmessageId(string, required): This is the main Message ID Example:t22c6DQcTDf3MjRhwf77message(string, required)contactId(string)dateAdded(string)emailMessageId(string)
json
{
"success": true,
"conversationId": "ABC12h2F6uBrIkfXYazb",
"messageId": "t22c6DQcTDf3MjRhwf77",
"message": "string",
"contactId": "string",
"dateAdded": "2024-01-15T10:30:00Z",
"emailMessageId": "string"
}400 - Bad Request
json
{}Example
curl -X POST 'https://services.leadconnectorhq.com/conversations/messages/inbound' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"type": "SMS",
"attachments": [
"string"
],
"message": "string",
"conversationId": "ve9EPM428h8vShlRW1KT",
"contactId": "ve9EPM428h8vShlRW1KT",
"conversationProviderId": "61d6d1f9cdac7612faf80753",
"html": "string",
"subject": "string",
"emailFrom": "sender@company.com",
"emailTo": "string",
"emailCc": [
"john1@doe.com",
"john2@doe.com"
],
"emailBcc": [
"john1@doe.com",
"john2@doe.com"
],
"emailMessageId": "string",
"altId": "61d6d1f9cdac7612faf80753",
"direction": [
"outbound",
"inbound"
],
"date": "2024-01-15T10:30:00Z"
}'const response = await fetch('https://services.leadconnectorhq.com/conversations/messages/inbound', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"type": "SMS", "attachments": ["string"], "message": "string", "conversationId": "ve9EPM428h8vShlRW1KT", "contactId": "ve9EPM428h8vShlRW1KT", "conversationProviderId": "61d6d1f9cdac7612faf80753", "html": "string", "subject": "string", "emailFrom": "sender@company.com", "emailTo": "string", "emailCc": ["john1@doe.com", "john2@doe.com"], "emailBcc": ["john1@doe.com", "john2@doe.com"], "emailMessageId": "string", "altId": "61d6d1f9cdac7612faf80753", "direction": ["outbound", "inbound"], "date": "2024-01-15T10:30:00Z"}),
});
const data = await response.json();import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/conversations/messages/inbound',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"type": "SMS", "attachments": ["string"], "message": "string", "conversationId": "ve9EPM428h8vShlRW1KT", "contactId": "ve9EPM428h8vShlRW1KT", "conversationProviderId": "61d6d1f9cdac7612faf80753", "html": "string", "subject": "string", "emailFrom": "sender@company.com", "emailTo": "string", "emailCc": ["john1@doe.com", "john2@doe.com"], "emailBcc": ["john1@doe.com", "john2@doe.com"], "emailMessageId": "string", "altId": "61d6d1f9cdac7612faf80753", "direction": ["outbound", "inbound"], "date": "2024-01-15T10:30:00Z"},
)
data = response.json()<?php
$ch = curl_init('https://services.leadconnectorhq.com/conversations/messages/inbound');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('LEADWAY_TOKEN'),
'Version: 2021-07-28',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode({'type': 'SMS', 'attachments': ['string'], 'message': 'string', 'conversationId': 've9EPM428h8vShlRW1KT', 'contactId': 've9EPM428h8vShlRW1KT', 'conversationProviderId': '61d6d1f9cdac7612faf80753', 'html': 'string', 'subject': 'string', 'emailFrom': 'sender@company.com', 'emailTo': 'string', 'emailCc': ['john1@doe.com', 'john2@doe.com'], 'emailBcc': ['john1@doe.com', 'john2@doe.com'], 'emailMessageId': 'string', 'altId': '61d6d1f9cdac7612faf80753', 'direction': ['outbound', 'inbound'], 'date': '2024-01-15T10:30:00Z'}),
]);
$data = json_decode(curl_exec($ch), true);