Skip to content

Messages

TypeDescription
emailA “normal” email BCC’d into Sheep.
templatedA templated message generated in Sheep, delivered by email.
templated-in-appA templated message generated in Sheep, delivered through the app.
templated-smsA templated message generated in Sheep, delivered through SMS. Additional costs apply.
templated-post(Future) A templated message generated in Sheep, printed on demand and posted. Additional costs apply.
StatusDescription
draftInitial / draft state.
sentSuccessfully handed off to the delivery system.
receivedUsed for external emails.
queuedWaiting to be handed to the delivery system.
failedThe generation or delivery system reported a failure.
failed_multiThe generation or delivery system reported a 2nd failure.
fatalA serious issue with message generation or delivery.
FieldDescription
process_dateRendering date/time.
regardingAdditional data to use in the template rendering.
acknowledgement_dateDate email acknowledged by user.
dateDate on email.
fromEmail of user sending / system account.
from_referencesheepCRM contact reference of sender.
html_messageThe rendered template (HTML).
text_messageThe rendered template (plain text).
rawThe raw template.
statusSee message status list above.
subjectEmail subject from template.
to_referencesheepCRM contact reference of recipient.
typeMessage delivery type.
uidSystem unique ID.
requires_acknowledgementFor use with in-app messages to collect acknowledgement.
FieldDescription
acknowledgement_dateDate email processed by sheepCRM.
cc_referencesheepCRM contact reference list.
dateDate on email.
filesList of file attachments (posted to S3).
fromEmail of sender (text).
from_referencesheepCRM contact reference of sender.
html_messageMessage body as HTML.
text_messageMessage body as text (HTML may be converted to text).
rawRaw message body.
statusWill always be “received”.
subjectEmail subject.
toMessage recipient (text).
to_referencesheepCRM contact reference of recipient.
uidIMAP message UID.
POST https://api.sheepcrm.com/api/v1/example/message/
Authorization: Bearer $API_KEY
Content-Type: application/json
{
"to_reference": "/example/person/5e7cf08e80859e2e284749a8/",
"subject": "hello",
"raw": "hi {{first_name}}",
"type": "templated"
}
HTTP/1.0 200 OK
{
"bucket": "example",
"data": {
"date": "2021-06-29T10:03:10.311000",
"delivery_status": null,
"raw": "hi {{first_name}}",
"status": "draft",
"subject": "hello",
"to_reference": [
{
"display_value": "James Webster",
"ref": "/example/person/5e7cf08e80859e2e284749a8/"
}
],
"type": "templated",
"uid": null
},
"uri": "/example/message/60daefde0a7750b55c83a257/"
}

The message record has been created as a draft. This can be previewed to check the body rendering:

GET https://api.sheepcrm.com/api/v1/example/message/60daefde0a7750b55c83a257/preview/
Authorization: Bearer $API_KEY
HTTP/1.1 200 OK
{
"bucket": "example",
"data": {
"content": {
"/example/person/5e7cf08e80859e2e284749a8/": {
"html": "<p>hi James</p>\n",
"text": "hi James"
}
},
"emails": {
"/example/person/5e7cf08e80859e2e284749a8/": "james@sheepcrm.com"
},
"errors": {
"/example/person/5e7cf08e80859e2e284749a8/": null
},
"raw": "hi {{first_name}}",
"status": "draft",
"subject": "hello",
"subjects": {
"/example/person/5e7cf08e80859e2e284749a8/": "hello"
},
"to_reference": [
{
"display_value": "James Webster",
"ref": "/example/person/5e7cf08e80859e2e284749a8/"
}
],
"type": "templated"
},
"uri": "/example/message/60daefde0a7750b55c83a257/"
}

Test the message by sending to yourself (the email associated with the API key). The preview shows the rendering but to see the full email within the wider HTML template, send an actual test message and check it in your email client.

POST https://api.sheepcrm.com/api/v1/example/message/60daefde0a7750b55c83a257/testsend/
Authorization: Bearer $API_KEY
POST https://api.sheepcrm.com/api/v1/example/message/60daefde0a7750b55c83a257/send/
Authorization: Bearer $API_KEY

For large numbers of recipients, send asynchronously (each email is rendered and sent individually so sending is slow):

POST https://api.sheepcrm.com/api/v1/example/message/60daefde0a7750b55c83a257/queue_and_send/
Authorization: Bearer $API_KEY