curl -X POST 'https://services.leadconnectorhq.com/conversations/messages' \
-H 'Authorization: Bearer YOUR_TOKEN' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/json' \
-d '{
"type": "Email",
"subType": "Email",
"contactId": "abc123def456",
"appointmentId": "appt123",
"attachments": [
"https://storage.com/file1.pdf",
"https://storage.com/file2.jpg"
],
"emailFrom": "sender@company.com",
"emailCc": [
"cc1@company.com",
"cc2@company.com"
],
"emailBcc": [
"bcc1@company.com",
"bcc2@company.com"
],
"html": "<p>Hello World</p>",
"message": "Hello, how can I help you today?",
"subject": "Important Update",
"replyMessageId": "msg123",
"templateId": "template123",
"threadId": "thread123",
"scheduledTimestamp": 1669287863,
"conversationProviderId": "provider123",
"emailTo": "recipient@company.com",
"customSubtypeId": "507f1f77bcf86cd799439011",
"emailReplyMode": "reply_all",
"fromNumber": "+1499499299",
"toNumber": "+1439499299",
"forward": {
"isForwarded": true,
"forwardWholeThread": false,
"messageId": "t22c6DQcTDf3MjRhwf77",
"emailMessageId": "rnGyqh2F6uBrIkfhFo9A",
"toEmail": "forward@example.com",
"recipientContactId": "DEF56h2F6uBrIkfXYacd"
},
"status": "delivered",
"usesNativeSchedulingAi": false,
"optimizationPeriod": "24h"
}'
const response = await fetch('https://services.leadconnectorhq.com/conversations/messages', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LEADWAY_TOKEN}`,
Version: '2021-07-28',
'Content-Type': 'application/json',
},
body: JSON.stringify({"type": "Email", "subType": "Email", "contactId": "abc123def456", "appointmentId": "appt123", "attachments": ["https://storage.com/file1.pdf", "https://storage.com/file2.jpg"], "emailFrom": "sender@company.com", "emailCc": ["cc1@company.com", "cc2@company.com"], "emailBcc": ["bcc1@company.com", "bcc2@company.com"], "html": "<p>Hello World</p>", "message": "Hello, how can I help you today?", "subject": "Important Update", "replyMessageId": "msg123", "templateId": "template123", "threadId": "thread123", "scheduledTimestamp": 1669287863, "conversationProviderId": "provider123", "emailTo": "recipient@company.com", "customSubtypeId": "507f1f77bcf86cd799439011", "emailReplyMode": "reply_all", "fromNumber": "+1499499299", "toNumber": "+1439499299", "forward": {"isForwarded": true, "forwardWholeThread": false, "messageId": "t22c6DQcTDf3MjRhwf77", "emailMessageId": "rnGyqh2F6uBrIkfhFo9A", "toEmail": "forward@example.com", "recipientContactId": "DEF56h2F6uBrIkfXYacd"}, "status": "delivered", "usesNativeSchedulingAi": false, "optimizationPeriod": "24h"}),
});
const data = await response.json();
import os, requests
response = requests.request(
'POST',
'https://services.leadconnectorhq.com/conversations/messages',
headers={
'Authorization': f"Bearer {os.environ['LEADWAY_TOKEN']}",
'Version': '2021-07-28',
'Content-Type': 'application/json',
},
json={"type": "Email", "subType": "Email", "contactId": "abc123def456", "appointmentId": "appt123", "attachments": ["https://storage.com/file1.pdf", "https://storage.com/file2.jpg"], "emailFrom": "sender@company.com", "emailCc": ["cc1@company.com", "cc2@company.com"], "emailBcc": ["bcc1@company.com", "bcc2@company.com"], "html": "<p>Hello World</p>", "message": "Hello, how can I help you today?", "subject": "Important Update", "replyMessageId": "msg123", "templateId": "template123", "threadId": "thread123", "scheduledTimestamp": 1669287863, "conversationProviderId": "provider123", "emailTo": "recipient@company.com", "customSubtypeId": "507f1f77bcf86cd799439011", "emailReplyMode": "reply_all", "fromNumber": "+1499499299", "toNumber": "+1439499299", "forward": {"isForwarded": true, "forwardWholeThread": false, "messageId": "t22c6DQcTDf3MjRhwf77", "emailMessageId": "rnGyqh2F6uBrIkfhFo9A", "toEmail": "forward@example.com", "recipientContactId": "DEF56h2F6uBrIkfXYacd"}, "status": "delivered", "usesNativeSchedulingAi": false, "optimizationPeriod": "24h"},
)
data = response.json()
<?php
$ch = curl_init('https://services.leadconnectorhq.com/conversations/messages');
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': 'Email', 'subType': 'Email', 'contactId': 'abc123def456', 'appointmentId': 'appt123', 'attachments': ['https://storage.com/file1.pdf', 'https://storage.com/file2.jpg'], 'emailFrom': 'sender@company.com', 'emailCc': ['cc1@company.com', 'cc2@company.com'], 'emailBcc': ['bcc1@company.com', 'bcc2@company.com'], 'html': '<p>Hello World</p>', 'message': 'Hello, how can I help you today?', 'subject': 'Important Update', 'replyMessageId': 'msg123', 'templateId': 'template123', 'threadId': 'thread123', 'scheduledTimestamp': 1669287863, 'conversationProviderId': 'provider123', 'emailTo': 'recipient@company.com', 'customSubtypeId': '507f1f77bcf86cd799439011', 'emailReplyMode': 'reply_all', 'fromNumber': '+1499499299', 'toNumber': '+1439499299', 'forward': {'isForwarded': true, 'forwardWholeThread': false, 'messageId': 't22c6DQcTDf3MjRhwf77', 'emailMessageId': 'rnGyqh2F6uBrIkfhFo9A', 'toEmail': 'forward@example.com', 'recipientContactId': 'DEF56h2F6uBrIkfXYacd'}, 'status': 'delivered', 'usesNativeSchedulingAi': false, 'optimizationPeriod': '24h'}),
]);
$data = json_decode(curl_exec($ch), true);