curl --request POST \
--url https://{subdomain}.conveyour.com/api/messages \
--header 'Content-Type: application/json' \
--header 'x-conveyour-token: <api-key>' \
--data '
{
"class": "<string>",
"type": "<string>",
"type_id": "<string>",
"body": "<string>",
"subject": "<string>",
"close": false,
"inherit_thread_close_state": false
}
'const options = {
method: 'POST',
headers: {'x-conveyour-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
class: '<string>',
type: '<string>',
type_id: '<string>',
body: JSON.stringify('<string>'),
subject: '<string>',
close: false,
inherit_thread_close_state: false
})
};
fetch('https://{subdomain}.conveyour.com/api/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {'x-conveyour-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
class: '<string>',
type: '<string>',
type_id: '<string>',
body: JSON.stringify('<string>'),
subject: '<string>',
close: false,
inherit_thread_close_state: false
})
};
fetch('https://{subdomain}.conveyour.com/api/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{subdomain}.conveyour.com/api/messages"
payload = {
"class": "<string>",
"type": "<string>",
"type_id": "<string>",
"body": "<string>",
"subject": "<string>",
"close": False,
"inherit_thread_close_state": False
}
headers = {
"x-conveyour-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.conveyour.com/api/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'class' => '<string>',
'type' => '<string>',
'type_id' => '<string>',
'body' => '<string>',
'subject' => '<string>',
'close' => false,
'inherit_thread_close_state' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-conveyour-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"status": "ok",
"message": "Message created",
"data": {
"id": "64a1b2c3d4e5f6a7b8c9d0e1",
"time": "just now"
}
}{
"status": "failed",
"message": "Lacking necessary permission add_contacts",
"data": {
"permission": "add_contacts"
}
}{
"status": "failed",
"message": "<string>",
"data": {}
}Create a message
Sends a message to a contact. Set class to "sms" or "email" to control the delivery channel, and identify the recipient with type: "contact" + type_id (the contact’s ID). There is no contact_id field on this endpoint — a posted contact_id is silently dropped and the message will fail to resolve a recipient. Address the message with type: "contact" and type_id: "<contact id>" instead.
Send an SMS or email to a contact
curl --request POST \
--url https://{subdomain}.conveyour.com/api/messages \
--header 'Content-Type: application/json' \
--header 'x-conveyour-token: <api-key>' \
--data '
{
"class": "<string>",
"type": "<string>",
"type_id": "<string>",
"body": "<string>",
"subject": "<string>",
"close": false,
"inherit_thread_close_state": false
}
'const options = {
method: 'POST',
headers: {'x-conveyour-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
class: '<string>',
type: '<string>',
type_id: '<string>',
body: JSON.stringify('<string>'),
subject: '<string>',
close: false,
inherit_thread_close_state: false
})
};
fetch('https://{subdomain}.conveyour.com/api/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const options = {
method: 'POST',
headers: {'x-conveyour-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
class: '<string>',
type: '<string>',
type_id: '<string>',
body: JSON.stringify('<string>'),
subject: '<string>',
close: false,
inherit_thread_close_state: false
})
};
fetch('https://{subdomain}.conveyour.com/api/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{subdomain}.conveyour.com/api/messages"
payload = {
"class": "<string>",
"type": "<string>",
"type_id": "<string>",
"body": "<string>",
"subject": "<string>",
"close": False,
"inherit_thread_close_state": False
}
headers = {
"x-conveyour-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{subdomain}.conveyour.com/api/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'class' => '<string>',
'type' => '<string>',
'type_id' => '<string>',
'body' => '<string>',
'subject' => '<string>',
'close' => false,
'inherit_thread_close_state' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-conveyour-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"status": "ok",
"message": "Message created",
"data": {
"id": "64a1b2c3d4e5f6a7b8c9d0e1",
"time": "just now"
}
}{
"status": "failed",
"message": "Lacking necessary permission add_contacts",
"data": {
"permission": "add_contacts"
}
}{
"status": "failed",
"message": "<string>",
"data": {}
}Authorizations
Your API key token. Contacts endpoints require a Server-only — Full API key — see Authentication.
Query Parameters
Team scope for the request, as one or more team ObjectIds. The brackets are required: PHP keeps only the last value for a repeated plain key, so teams=A&teams=B silently resolves to B alone. On requests with a JSON body you may send teams (no brackets) in the body instead.
Values that are not valid ObjectIds are silently ignored — a mistyped team ID behaves as if no team was sent. See the teams section of the API conventions guide.
Body
The delivery channel. Either "sms" or "email".
The recipient type. Use "contact" to send to a single contact. (Other values: bookmark, trigger, campaign, trigger_lesson, trigger_wait.)
The ID of the recipient. When type is "contact", this is the contact's ID.
The message body. Supports Liquid syntax for personalization.
Email subject line. Required when class is "email". Supports Liquid syntax.
Close the conversation thread after sending.
Adopt the thread's existing closed state instead of setting it explicitly.
Response
Success.
The common response envelope shared by all ConveYour endpoints.