Skip to main content

Message API

Usageโ€‹

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.message.sendMessage(...)

Tree-shakeable importโ€‹

import { getClient, authorize } from '@epilot/sdk/message'

const messageClient = getClient()
authorize(messageClient, () => '<token>')
const { data } = await messageClient.sendMessage(...)

Operationsโ€‹

Messages

Threads

Drafts

Schemas

sendMessageโ€‹

Send an email message

POST /v1/message/messages

const { data } = await client.sendMessage(
{
do_not_create_entities: true,
},
{},
)
Response
{}

updateMessageโ€‹

Update message metadata

PUT /v1/message/messages

const { data } = await client.updateMessage()
Response
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"message_id": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>",
"sender": "206801",
"subject": "Request for solar panel price",
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
"from": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"reply_to": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"to": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"cc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"bcc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"file": {
"$relation": [
{
"entity_id": "f820ce3b-07b0-45ae-bcc6-babb2f53f79f",
"filename": "Produktinformationen_epilot360_Double_Opt_in.pdf",
"is_message_attachment": true,
"may_be_signature_attachment": true,
"cid": "fb222496-a1a5-4639-94f2-07b5e35e4068",
"inline": false,
"send_as_link": false
}
]
},
"references": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> <CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"in_reply_to": "<CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"user_read_message": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"send_status": ["SEND"],
"type": "SENT",
"template_id": "3f34ce73-089c-4d45-a5ee-c161234e41c3"
}

getMessageโ€‹

Get an email message by id

GET /v1/message/messages/{id}

const { data } = await client.getMessage({
id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"message_id": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>",
"sender": "206801",
"subject": "Request for solar panel price",
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
"from": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"reply_to": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"to": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"cc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"bcc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"file": {
"$relation": [
{
"entity_id": "f820ce3b-07b0-45ae-bcc6-babb2f53f79f",
"filename": "Produktinformationen_epilot360_Double_Opt_in.pdf",
"is_message_attachment": true,
"may_be_signature_attachment": true,
"cid": "fb222496-a1a5-4639-94f2-07b5e35e4068",
"inline": false,
"send_as_link": false
}
]
},
"references": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> <CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"in_reply_to": "<CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"user_read_message": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"send_status": ["SEND"],
"type": "SENT",
"template_id": "3f34ce73-089c-4d45-a5ee-c161234e41c3"
}

deleteMessageโ€‹

Immediately and permanently delete a message. This operation cannot be undone.

DELETE /v1/message/messages/{id}

const { data } = await client.deleteMessage({
id: '123e4567-e89b-12d3-a456-426614174000',
})

getMessageEmlโ€‹

Download a message as an EML file. Returns a 302 redirect to a pre-signed S3 URL where the EML file can be downloaded.

GET /v1/message/messages/{id}/eml

const { data } = await client.getMessageEml({
id: '123e4567-e89b-12d3-a456-426614174000',
})

searchMessagesโ€‹

Search Messages

POST /v1/message/messages:search

const { data } = await client.searchMessages(
null,
{
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
q: 'subject:"Request for solar panel price" AND _tags:INBOX',
fields: ['_id', '_title', 'first_name', 'account', '!account.*._files', '**._product'],
from: 0,
size: 10,
hydrate: false,
include_scores: false,
sort: 'string',
highlight: {}
},
)
Response
{
"hits": 14,
"results": [
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"message_id": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>",
"sender": "206801",
"subject": "Request for solar panel price",
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
"from": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"reply_to": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"to": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"cc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"bcc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"file": {
"$relation": [
{
"entity_id": "f820ce3b-07b0-45ae-bcc6-babb2f53f79f",
"filename": "Produktinformationen_epilot360_Double_Opt_in.pdf",
"is_message_attachment": true,
"may_be_signature_attachment": true,
"cid": "fb222496-a1a5-4639-94f2-07b5e35e4068",
"inline": false,
"send_as_link": false
}
]
},
"references": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> <CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"in_reply_to": "<CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"user_read_message": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"send_status": ["SEND"],
"type": "SENT",
"template_id": "3f34ce73-089c-4d45-a5ee-c161234e41c3"
}
]
}

trashMessageโ€‹

Move a message to the trash

POST /v1/message/messages/{id}/trash

const { data } = await client.trashMessage({
id: '123e4567-e89b-12d3-a456-426614174000',
})

untrashMessageโ€‹

Restore a trashed message

POST /v1/message/messages/{id}/untrash

const { data } = await client.untrashMessage({
id: '123e4567-e89b-12d3-a456-426614174000',
})

markReadMessageโ€‹

Mark message as read

POST /v1/message/messages/{id}/read

const { data } = await client.markReadMessage({
id: '123e4567-e89b-12d3-a456-426614174000',
})

markReadMessageV2โ€‹

Mark message as read within a scope

POST /v2/message/messages/{id}/read

const { data } = await client.markReadMessageV2(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
{
scopes: ['organization', 'user']
},
)

markUnreadMessageโ€‹

Mark message as unread

POST /v1/message/messages/{id}/unread

const { data } = await client.markUnreadMessage({
id: '123e4567-e89b-12d3-a456-426614174000',
})

getUnreadโ€‹

Get all unread messages by actor

GET /v1/message/messages/unread/{actor}

const { data } = await client.getUnread({
actor: 'example',
email_filter: ['...'],
})
Response
{
"count": 14,
"unread": 0,
"drafts": 12,
"unassigned": 1
}

markUnreadMessageV2โ€‹

Mark message as unread within a scope

POST /v2/message/messages/{id}/unread

const { data } = await client.markUnreadMessageV2(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
{
scopes: ['organization', 'user']
},
)

searchThreadsโ€‹

Search for threads of email messages.

POST /v1/message/threads:search

const { data } = await client.searchThreads(
null,
{
q: 'subject:"Request for solar panel price" AND _tags:INBOX',
from: 0,
size: 10,
hydrate: false
},
)
Response
{
"hits": 14,
"results": [
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"topic": "CUSTOMER_MESSAGE",
"assigned_to": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"done": false,
"latest_message": {},
"latest_trash_message": {},
"latest_message_at": "2024-02-10T09:14:31.990Z"
}
]
}

searchThreadsV2โ€‹

Search for threads of email messages.

POST /v2/message/threads:search

const { data } = await client.searchThreadsV2(
null,
{
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
q: 'subject:"Request for solar panel price" AND _tags:INBOX',
fields: ['_id', '_title', 'first_name', 'account', '!account.*._files', '**._product'],
from: 0,
size: 10,
hydrate: false,
include_scores: false,
sort: 'string',
highlight: {}
},
)
Response
{
"hits": 14,
"results": [
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"topic": "CUSTOMER_MESSAGE",
"assigned_to": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"done": false,
"latest_message": {},
"latest_trash_message": {},
"latest_message_at": "2024-02-10T09:14:31.990Z"
}
]
}

searchIdsโ€‹

Search threads and return all id's

POST /v1/message/threads:searchIds

const { data } = await client.searchIds(
null,
{
q: 'subject:"Request for solar panel price" AND _tags:INBOX'
},
)
Response
{
"hits": 14,
"results": ["string"]
}

updateThreadโ€‹

Modify thread metadata

PUT /v1/message/threads

const { data } = await client.updateThread()
Response
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"topic": "CUSTOMER_MESSAGE",
"assigned_to": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"done": false,
"latest_message": {
"message_id": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>",
"sender": "206801",
"subject": "Request for solar panel price",
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
"from": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"reply_to": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"to": [
{}
],
"cc": [
{}
],
"bcc": [
{}
],
"file": {
"$relation": []
},
"references": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> <CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"in_reply_to": "<CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"user_read_message": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"send_status": ["SEND"],
"type": "SENT",
"template_id": "3f34ce73-089c-4d45-a5ee-c161234e41c3"
},
"latest_trash_message": {
"message_id": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>",
"sender": "206801",
"subject": "Request for solar panel price",
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
"from": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"reply_to": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"to": [
{}
],
"cc": [
{}
],
"bcc": [
{}
],
"file": {
"$relation": []
},
"references": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> <CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"in_reply_to": "<CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"user_read_message": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"send_status": ["SEND"],
"type": "SENT",
"template_id": "3f34ce73-089c-4d45-a5ee-c161234e41c3"
},
"latest_message_at": "2024-02-10T09:14:31.990Z"
}

deleteThreadโ€‹

Immediately and permanently delete a thread. This operation cannot be undone.

DELETE /v1/message/threads/{id}

const { data } = await client.deleteThread({
id: '123e4567-e89b-12d3-a456-426614174000',
})

moveThreadโ€‹

Move thread to a different Inbox

POST /v1/message/threads/{id}:move

const { data } = await client.moveThread(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
{
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3'
},
)

markThreadAsDoneโ€‹

Mark thread as done

POST /v1/message/threads/{id}:markAsDone

const { data } = await client.markThreadAsDone({
id: '123e4567-e89b-12d3-a456-426614174000',
})

markThreadAsOpenโ€‹

Mark thread as open

POST /v1/message/threads/{id}:markAsOpen

const { data } = await client.markThreadAsOpen({
id: '123e4567-e89b-12d3-a456-426614174000',
})

getThreadTimelineโ€‹

Get thread timeline

GET /v1/message/threads/{id}/timeline

const { data } = await client.getThreadTimeline({
id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
"events": [
{
"data": {
"type": "THREAD_DONE",
"user_id": "123",
"organization_id": "456"
},
"timestamp": "2024-01-01T00:00:00.000Z"
}
]
}

trashThreadโ€‹

Move a thread to trash

POST /v1/message/threads/{id}/trash

const { data } = await client.trashThread({
id: '123e4567-e89b-12d3-a456-426614174000',
})

untrashThreadโ€‹

Restore a trashed thread

POST /v1/message/threads/{id}/untrash

const { data } = await client.untrashThread({
id: '123e4567-e89b-12d3-a456-426614174000',
})

threadBulkActionsReadโ€‹

Perform a bulk action of marking an array of thread ids as read

POST /v1/message/threads/bulk:read

const { data } = await client.threadBulkActionsRead(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531'],
scopes: ['organization', 'user']
},
)

threadBulkActionsUnreadโ€‹

Perform a bulk action of marking an array of thread ids as unread

POST /v1/message/threads/bulk:unread

const { data } = await client.threadBulkActionsUnread(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531'],
scopes: ['organization', 'user']
},
)

threadBulkActionsFavoriteโ€‹

Perform a bulk action of marking an array of thread ids favorite

POST /v1/message/threads/bulk:favorite

const { data } = await client.threadBulkActionsFavorite(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531']
},
)

threadBulkActionsUnfavoriteโ€‹

Perform a bulk action of marking an array of thread ids unfavorited

POST /v1/message/threads/bulk:unfavorite

const { data } = await client.threadBulkActionsUnfavorite(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531']
},
)

threadBulkActionsTrashโ€‹

Perform a bulk action of trashing an array of threads

POST /v1/message/threads/bulk:trash

const { data } = await client.threadBulkActionsTrash(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531']
},
)

threadBulkActionsUntrashโ€‹

Perform a bulk action of untrashing an array of threads

POST /v1/message/threads/bulk:untrash

const { data } = await client.threadBulkActionsUntrash(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531']
},
)

threadBulkActionsDeleteโ€‹

Performs a bulk permanent delete for all threads

POST /v1/message/threads/bulk:delete

const { data } = await client.threadBulkActionsDelete(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531']
},
)

threadBulkActionsDoneโ€‹

Perform a bulk action of marking an array of threads as done

POST /v1/message/threads/bulk:done

const { data } = await client.threadBulkActionsDone(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531']
},
)

threadBulkActionsOpenโ€‹

Perform a bulk action of marking an array of threads as open

POST /v1/message/threads/bulk:open

const { data } = await client.threadBulkActionsOpen(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531']
},
)

markReadThreadโ€‹

Mark thread as read

POST /v1/message/threads/{id}/read

const { data } = await client.markReadThread({
id: '123e4567-e89b-12d3-a456-426614174000',
})

markReadThreadV2โ€‹

Mark thread as read within a scope

POST /v2/message/threads/{id}/read

const { data } = await client.markReadThreadV2(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
{
scopes: ['organization', 'user']
},
)

markUnreadThreadโ€‹

Mark thread as unread

POST /v1/message/threads/{id}/unread

const { data } = await client.markUnreadThread({
id: '123e4567-e89b-12d3-a456-426614174000',
})

markUnreadThreadV2โ€‹

Mark thread as unread within a scope

POST /v2/message/threads/{id}/unread

const { data } = await client.markUnreadThreadV2(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
{
scopes: ['organization', 'user']
},
)

assignThreadโ€‹

Assign thread to entities

POST /v1/message/threads/{id}/assign

const { data } = await client.assignThread(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
[
{
slug: 'contact',
entity_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
org_id: '206801',
is_main_entity: true
}
],
)

unassignThreadโ€‹

Unassign thread from entities

POST /v1/message/threads/{id}/unassign

const { data } = await client.unassignThread(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
[
{
slug: 'contact',
entity_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3'
}
],
)

assignUsersโ€‹

Assign users to thread for receiving notifications. The operation replaces all existing assigned users in thread.

POST /v1/message/threads/{id}/assign:users

const { data } = await client.assignUsers(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
{
assigned_to: ['206801']
},
)

assignUsersV2โ€‹

Assign users to thread.

POST /v2/message/threads/{id}/assign:users

const { data } = await client.assignUsersV2(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
{
add: ['206801'],
remove: ['206801']
},
)

pinThreadโ€‹

Pin a single thread

POST /v1/message/threads/{id}:pin

const { data } = await client.pinThread({
id: '123e4567-e89b-12d3-a456-426614174000',
})

unpinThreadโ€‹

Unpin a single thread

DELETE /v1/message/threads/{id}:pin

const { data } = await client.unpinThread({
id: '123e4567-e89b-12d3-a456-426614174000',
})

createDraftโ€‹

Create a new draft

POST /v1/message/drafts

const { data } = await client.createDraft(
null,
{},
)
Response
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"message_id": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>",
"sender": "206801",
"subject": "Request for solar panel price",
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
"from": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"reply_to": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"to": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"cc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"bcc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"file": {
"$relation": [
{
"entity_id": "f820ce3b-07b0-45ae-bcc6-babb2f53f79f",
"filename": "Produktinformationen_epilot360_Double_Opt_in.pdf",
"is_message_attachment": true,
"may_be_signature_attachment": true,
"cid": "fb222496-a1a5-4639-94f2-07b5e35e4068",
"inline": false,
"send_as_link": false
}
]
},
"references": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> <CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"in_reply_to": "<CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"user_read_message": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"send_status": ["SEND"],
"type": "SENT",
"template_id": "3f34ce73-089c-4d45-a5ee-c161234e41c3"
}

sendDraftโ€‹

Send the existing draft to the recipients

POST /v1/message/drafts:send

const { data } = await client.sendDraft()
Response
{
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"message_id": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>",
"sender": "206801",
"subject": "Request for solar panel price",
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
"from": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"reply_to": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"to": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"cc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"bcc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"file": {
"$relation": [
{
"entity_id": "f820ce3b-07b0-45ae-bcc6-babb2f53f79f",
"filename": "Produktinformationen_epilot360_Double_Opt_in.pdf",
"is_message_attachment": true,
"may_be_signature_attachment": true,
"cid": "fb222496-a1a5-4639-94f2-07b5e35e4068",
"inline": false,
"send_as_link": false
}
]
},
"references": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> <CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"in_reply_to": "<CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"user_read_message": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"send_status": ["SEND"],
"type": "SENT",
"template_id": "3f34ce73-089c-4d45-a5ee-c161234e41c3"
}

getMessageV2โ€‹

  • Fetches message by ID
  • If the message html is omitted on the entity, then it keeps the content on the message as a signed url { ... _id: "4d74976d-fb64-47fd-85e2-65eea140f5eb", _schem

GET /v2/message/messages/{id}

const { data } = await client.getMessageV2({
id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
"html_omitted": false,
"html_download_url": "https://s3.eu-central-1.amazonaws.com/epilot-attachments/3f34ce73-089c-4d45-a5ee-c161234e41c3/3f34ce73-089c-4d45-a5ee-c161234e41c3.html",
"_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"_title": "string",
"_org": "206801",
"_schema": "message",
"_tags": ["pricing", "INBOX"],
"_created_at": "2021-02-09T12:41:43.662Z",
"_updated_at": "2021-02-10T09:14:31.990Z",
"message_id": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com>",
"sender": "206801",
"subject": "Request for solar panel price",
"html": "<div>We at ABC GmbH would like to request a price quote for the solar panel.</div>",
"text": "We at ABC GmbH would like to request a price quote for the solar panel.",
"from": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"reply_to": {
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
},
"to": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"cc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"bcc": [
{
"name": "epilot",
"address": "messaging@epilot.cloud",
"email_type": "INTERNAL",
"send_status": "SEND",
"send_error": {}
}
],
"file": {
"$relation": [
{
"entity_id": "f820ce3b-07b0-45ae-bcc6-babb2f53f79f",
"filename": "Produktinformationen_epilot360_Double_Opt_in.pdf",
"is_message_attachment": true,
"may_be_signature_attachment": true,
"cid": "fb222496-a1a5-4639-94f2-07b5e35e4068",
"inline": false,
"send_as_link": false
}
]
},
"references": "<0102017b97a502f8-a67f01c2-68cc-4928-b91b-45853f34e259-000000@eu-west-1.amazonses.com> <CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"in_reply_to": "<CALHgQpziyxW9NaFUs+nRMykzr6Ljq6vjq4WO9SaihAuMasuDyg@mail.gmail.com>",
"user_read_message": ["206801", "200109"],
"org_read_message": ["789372", "210291"],
"send_status": ["SEND"],
"type": "SENT",
"template_id": "3f34ce73-089c-4d45-a5ee-c161234e41c3"
}

Schemasโ€‹

ErrorResponseโ€‹

type ErrorResponse = {
error?: string
}

MoveThreadPayloadโ€‹

type MoveThreadPayload = {
inbox_id: string
}

BaseEntityโ€‹

type BaseEntity = {
_id: string
_title: string
_org: string
_schema: string
_tags?: string[]
_created_at: string // date-time
_updated_at: string // date-time
}

Threadโ€‹

Thread properties depend on API caller as it's not pre-defined. We do recommend having at least topic property for categorizing.

type Thread = {
topic: string
assigned_to?: string[]
org_read_message?: string[]
done?: boolean
latest_message?: {
message_id?: string
sender?: string
subject: string
html?: string
text?: string
from: {
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}
reply_to?: {
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}
to?: Array<{
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}>
cc?: Array<{
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}>
bcc?: Array<{
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}>
file?: {
$relation?: { ... }
}
references?: string
in_reply_to?: string
user_read_message?: string[]
org_read_message?: string[]
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"[]
type?: "SENT" | "RECEIVED"
template_id?: string
}
latest_trash_message?: {
message_id?: string
sender?: string
subject: string
html?: string
text?: string
from: {
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}
reply_to?: {
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}
to?: Array<{
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}>
cc?: Array<{
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}>
bcc?: Array<{
name?: { ... }
address: { ... }
email_type?: { ... }
send_status?: { ... }
send_error?: { ... }
}>
file?: {
$relation?: { ... }
// ...
}

Messageโ€‹

type Message = {
message_id?: string
sender?: string
subject: string
html?: string
text?: string
from: {
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}
reply_to?: {
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}
to?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
cc?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
bcc?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
file?: {
$relation?: Array<{
entity_id: { ... }
filename?: { ... }
is_message_attachment?: { ... }
may_be_signature_attachment?: { ... }
cid?: { ... }
inline?: { ... }
send_as_link?: { ... }
}>
}
references?: string
in_reply_to?: string
user_read_message?: string[]
org_read_message?: string[]
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"[]
type?: "SENT" | "RECEIVED"
template_id?: string
}

MessageV2โ€‹

type MessageV2 = {
_id: string
_title: string
_org: string
_schema: string
_tags?: string[]
_created_at: string // date-time
_updated_at: string // date-time
message_id?: string
sender?: string
subject: string
html?: string
text?: string
from: {
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}
reply_to?: {
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}
to?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
cc?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
bcc?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
file?: {
$relation?: Array<{
entity_id: { ... }
filename?: { ... }
is_message_attachment?: { ... }
may_be_signature_attachment?: { ... }
cid?: { ... }
inline?: { ... }
send_as_link?: { ... }
}>
}
references?: string
in_reply_to?: string
user_read_message?: string[]
org_read_message?: string[]
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"[]
type?: "SENT" | "RECEIVED"
template_id?: string
}

Addressโ€‹

type Address = {
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}

AttachmentsRelationโ€‹

Message attachments

type AttachmentsRelation = {
$relation?: Array<{
entity_id: string
filename?: string
is_message_attachment?: boolean
may_be_signature_attachment?: boolean
cid?: string
inline?: boolean
send_as_link?: boolean
}>
}

Fileโ€‹

type File = {
entity_id: string
filename?: string
is_message_attachment?: boolean
may_be_signature_attachment?: boolean
cid?: string
inline?: boolean
send_as_link?: boolean
}

MessageRequestParamsโ€‹

type MessageRequestParams = {
complete_thread?: boolean
thread?: {
topic: string
assigned_to?: string[]
}
parent_id?: string
subject: string
html?: string
text?: string
from: {
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}
reply_to?: {
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}
to?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
cc?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
bcc?: Array<{
name?: string
address: string
email_type?: "INTERNAL" | "EXTERNAL" | "PARTNER"
send_status?: "SEND" | "DELIVERY" | "REJECT" | "COMPLAINT" | "BOUNCE" | "ERROR"
send_error?: object
}>
file?: {
$relation?: Array<{
entity_id: { ... }
filename?: { ... }
is_message_attachment?: { ... }
may_be_signature_attachment?: { ... }
cid?: { ... }
inline?: { ... }
send_as_link?: { ... }
}>
}
template_id?: string
}

SearchParamsV2โ€‹

type SearchParamsV2 = {
inbox_id?: string | string[]
q: string
fields?: string[]
from?: number
size?: number
hydrate?: boolean
include_scores?: boolean
sort?: string
highlight?: unknown
}

SearchParamsโ€‹

type SearchParams = {
q: string
from?: number
size?: number
hydrate?: boolean
}

SearchIDParamsโ€‹

type SearchIDParams = {
q?: string
}

ReadMessagePayloadโ€‹

type ReadMessagePayload = {
scopes: "organization" | "user"[]
}

ReadingScopeโ€‹

Who is marking an item as read or unread.

type ReadingScope = "organization" | "user"

ThreadTimelineโ€‹

type ThreadTimeline = {
events: Array<{
data: {
type: { ... }
user_id: { ... }
organization_id: { ... }
} | {
type: { ... }
user_id: { ... }
organization_id: { ... }
}
timestamp: string
}>
}

ThreadDoneEventโ€‹

type ThreadDoneEvent = {
type: "THREAD_DONE"
user_id: string
organization_id: string
}

ThreadOpenEventโ€‹

type ThreadOpenEvent = {
type: "THREAD_OPEN"
user_id: string
organization_id: string
}

TimelineEventDataโ€‹

type TimelineEventData = {
type: "THREAD_DONE"
user_id: string
organization_id: string
} | {
type: "THREAD_OPEN"
user_id: string
organization_id: string
}

TimelineEventโ€‹

type TimelineEvent = {
data: {
type: "THREAD_DONE"
user_id: string
organization_id: string
} | {
type: "THREAD_OPEN"
user_id: string
organization_id: string
}
timestamp: string
}

BulkActionsPayloadWithScopesโ€‹

type BulkActionsPayloadWithScopes = {
ids: string[]
scopes?: "organization" | "user"[]
}

BulkActionsPayloadโ€‹

type BulkActionsPayload = {
ids: string[]
}

FieldsParamโ€‹

List of entity fields to include or exclude in the response

Use ! to exclude fields, e.g. !_id to exclude the _id field.

Globbing and globstart (**) is supported for nested fields.

type FieldsParam = string[]