curl --request POST \
--url https://{organization}.rescueconsole.com/api/communications/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"person_id": "6d1f3a52-0b7e-4c1a-9d2f-5e8b7c4a1f20",
"template_key": "adoption_meet_greet",
"related_entity_type": "animal",
"related_entity_id": "a3c9e1f4-2d6b-4f8a-b1c7-9e0d5f3a2b61",
"category": "adoptions",
"cc": [
"fosters@contoso.com"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
person_id: '6d1f3a52-0b7e-4c1a-9d2f-5e8b7c4a1f20',
template_key: 'adoption_meet_greet',
related_entity_type: 'animal',
related_entity_id: 'a3c9e1f4-2d6b-4f8a-b1c7-9e0d5f3a2b61',
category: 'adoptions',
cc: ['fosters@contoso.com']
})
};
fetch('https://{organization}.rescueconsole.com/api/communications/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{organization}.rescueconsole.com/api/communications/send"
payload = {
"person_id": "6d1f3a52-0b7e-4c1a-9d2f-5e8b7c4a1f20",
"template_key": "adoption_meet_greet",
"related_entity_type": "animal",
"related_entity_id": "a3c9e1f4-2d6b-4f8a-b1c7-9e0d5f3a2b61",
"category": "adoptions",
"cc": ["fosters@contoso.com"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"recipient_address": "<string>",
"direction": "outbound",
"channel": "email",
"category": "<string>",
"status": "queued",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"template_id": "<string>",
"person_id": "<string>",
"provider": "<string>",
"provider_message_id": "<string>",
"subject": "<string>",
"related_entity_type": "<string>",
"related_entity_id": "<string>",
"payload_metadata": {
"reason": "<string>",
"suppression_scope": "platform",
"suppression_reason": "<string>",
"failover_attempts": [
{
"tier": 123,
"provider": "<string>",
"success": true,
"error": "<string>",
"provider_message_id": "<string>",
"attempted_at": "2023-11-07T05:31:56Z"
}
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"copies_suppressed": [
"<string>"
],
"thread_id": "<string>",
"error": "<string>"
}
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}Send an email
Sends one email now, from your organization’s sending address. This sends real email to real people, and it cannot be undone. Once the email service accepts a message it is on its way, and nothing can recall it. There is no test mode.
Who it goes to: person_id sends to that person’s email on file; recipient_address sends to that address, and wins when you send both. cc and bcc add up to 20 copies each.
What it says: either template_key, naming an active template, or both subject and body_text. A template is filled from the person, from the animal or adoption application in related_entity_type and related_entity_id, and from your organization’s name; what you send in variables wins over the records. If any merge field is left unfilled, nothing is sent and the answer is 400. Merge fields are written {{first_name}}. Filled from your records: first_name, last_name, full_name, email, phone (the person), animal_name, animal_species, animal_breed, animal_sex, animal_id (the animal’s Pet ID) and org_name. Anything else, such as org_email, org_phone or org_website, is filled only from the variables you send. The message goes out as plain text, and replies to it arrive in your organization’s default inbox.
What stops it, checked in this order, before anything is sent:
- The address is suppressed. An address that hard-bounced is suppressed for every organization and cannot be released; one that complained or unsubscribed is suppressed for your organization only. See Suppressions.
- The person in
person_idhas opted out of email altogether, or out of this message’scategory. See Contact preferences. An address sent without aperson_idis not checked against anybody’s preferences.
A stopped message still answers 201, with status suppressed and the reason in payload_metadata.reason. A copy to a suppressed address is dropped and the rest of the message still goes; the dropped addresses are in payload_metadata.copies_suppressed.
Read status on the answer: sent means the email service accepted it, failed means it did not, which is also the answer while your organization cannot send email, for example while its own domain waits to be verified (each attempt and why it failed is in payload_metadata.failover_attempts), and suppressed means it was stopped. Every one is written to the message log.
Needs write on Communications.
curl --request POST \
--url https://{organization}.rescueconsole.com/api/communications/send \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"person_id": "6d1f3a52-0b7e-4c1a-9d2f-5e8b7c4a1f20",
"template_key": "adoption_meet_greet",
"related_entity_type": "animal",
"related_entity_id": "a3c9e1f4-2d6b-4f8a-b1c7-9e0d5f3a2b61",
"category": "adoptions",
"cc": [
"fosters@contoso.com"
]
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
person_id: '6d1f3a52-0b7e-4c1a-9d2f-5e8b7c4a1f20',
template_key: 'adoption_meet_greet',
related_entity_type: 'animal',
related_entity_id: 'a3c9e1f4-2d6b-4f8a-b1c7-9e0d5f3a2b61',
category: 'adoptions',
cc: ['fosters@contoso.com']
})
};
fetch('https://{organization}.rescueconsole.com/api/communications/send', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://{organization}.rescueconsole.com/api/communications/send"
payload = {
"person_id": "6d1f3a52-0b7e-4c1a-9d2f-5e8b7c4a1f20",
"template_key": "adoption_meet_greet",
"related_entity_type": "animal",
"related_entity_id": "a3c9e1f4-2d6b-4f8a-b1c7-9e0d5f3a2b61",
"category": "adoptions",
"cc": ["fosters@contoso.com"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"id": "<string>",
"recipient_address": "<string>",
"direction": "outbound",
"channel": "email",
"category": "<string>",
"status": "queued",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"template_id": "<string>",
"person_id": "<string>",
"provider": "<string>",
"provider_message_id": "<string>",
"subject": "<string>",
"related_entity_type": "<string>",
"related_entity_id": "<string>",
"payload_metadata": {
"reason": "<string>",
"suppression_scope": "platform",
"suppression_reason": "<string>",
"failover_attempts": [
{
"tier": 123,
"provider": "<string>",
"success": true,
"error": "<string>",
"provider_message_id": "<string>",
"attempted_at": "2023-11-07T05:31:56Z"
}
],
"cc": [
"<string>"
],
"bcc": [
"<string>"
],
"copies_suppressed": [
"<string>"
],
"thread_id": "<string>",
"error": "<string>"
}
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}{
"error": "house_trained must be 1, 0 or null (not assessed)"
}Authorizations
An API key from Settings, API keys. It starts with rc_live_.
Body
Send person_id or recipient_address, or both.
A person on file. The message goes to their email unless you also send recipient_address.
The address to send to. It wins over the person's email when you send both.
The key of an active template. Send this, or both subject and body_text.
The body, as plain text.
Values for the template's merge fields, by name. They win over the records.
What kind of message this is, checked against the person's opt-outs.
The record the message is about. An animal or an adoption_application fills the animal merge fields. Kept on the log entry.
Copies, 20 at most.
20Blind copies, 20 at most.
20Response
The log entry for this message. Read its status: 201 does not by itself mean the email was sent.
Who it was to. For a message sent from a conversation to several people, their addresses separated by commas.
outbound, inbound email The kind of message, as the sender named it. general unless the sender said otherwise; inbox_new and inbox_reply for messages sent from a conversation.
suppressed: stopped before sending. sent: the email service accepted it and no delivery report has come back yet. delivered or bounced: what the delivery report said. failed: the email service did not accept it, or reported that it could not deliver it. received: a message that came in. A status never moves back.
queued, sent, delivered, failed, bounced, received, suppressed Your organization's ID.
The template it was sent from.
The person it was to, when it was sent to a person on file.
The email service that handled it. Null when it never reached one.
The email service's own ID for the message.
The subject as sent. The log keeps the subject, not the body.
The record it was about. email_thread for a message sent from a conversation, with the conversation's ID in related_entity_id.
Detail about what happened. Only the keys that apply are present.
Show child attributes
Show child attributes