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",
"updated_by": "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,
"save_to_entity": true
}
]
},
"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",
"updated_by": "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,
"save_to_entity": true
}
]
},
"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',
view: {
folder: 'inbox',
mailbox: 'organization',
labels: ['string'],
purposes: ['string'],
filters: ['unread'],
from: ['string'],
to: ['string'],
assigned_to: ['string'],
include_unassigned: true,
date_from_days_ago: 0,
date_to_days_ago: 0,
email_filter: ['string'],
text: 'string',
thread_ids: ['string'],
pinned_by: 'string'
},
user_groups: ['string'],
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",
"updated_by": "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,
"save_to_entity": true
}
]
},
"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,
"spam": 3
}

getUnreadCounts​

Unread counts for several named scopes in one request.

POST /v1/message/unread:counts

const { data } = await client.getUnreadCounts(
null,
{
actor: 'organization',
email_filter: ['string'],
user_groups: ['string'],
scopes: [
{
name: 'inbox-support',
type: 'organization',
q: '_tags.keyword:inbox AND !_tags.keyword:trash',
view_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3'
}
]
},
)
Response
{
"enabled": true,
"counts": {},
"omitted": ["string"]
}

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',
view: {
folder: 'inbox',
mailbox: 'organization',
labels: ['string'],
purposes: ['string'],
filters: ['unread'],
from: ['string'],
to: ['string'],
assigned_to: ['string'],
include_unassigned: true,
date_from_days_ago: 0,
date_to_days_ago: 0,
email_filter: ['string'],
text: 'string',
thread_ids: ['string'],
pinned_by: 'string'
},
user_groups: ['string'],
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,
{
view: {
folder: 'inbox',
mailbox: 'organization',
labels: ['string'],
purposes: ['string'],
filters: ['unread'],
from: ['string'],
to: ['string'],
assigned_to: ['string'],
include_unassigned: true,
date_from_days_ago: 0,
date_to_days_ago: 0,
email_filter: ['string'],
text: 'string',
thread_ids: ['string'],
pinned_by: 'string'
},
user_groups: ['string'],
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
q: 'subject:"Request for solar panel price" AND _tags:INBOX'
},
)
Response
{
"hits": 14,
"results": ["string"]
}

getAssigneeWorkload​

Return the open-thread workload for a set of user ids.

POST /v2/message/threads:workload

const { data } = await client.getAssigneeWorkload(
null,
{
user_ids: ['11000902', '11001053']
},
)
Response
{
"workloads": [
{
"user_id": "11000902",
"open_threads": 2
}
]
}

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",
"updated_by": "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",
"updated_by": "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": [
{
"id": "string",
"data": {
"type": "THREAD_DONE",
"user_id": "123",
"organization_id": "456"
},
"timestamp": "2024-01-01T00:00:00Z",
"message_id": "string",
"source": "user",
"automated": true,
"actor": {
"user_id": "string",
"email": "string"
},
"automation": {
"id": "string",
"name": "string"
}
}
]
}

getThreadSummary​

AI summary of a thread. Returns 202 while it is generated; poll until jobStatus.status is COMPLETED or FAILED.

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

const { data } = await client.getThreadSummary({
id: '123e4567-e89b-12d3-a456-426614174000',
message_id: 'example',
})
Response
{
"orgId": "string",
"jobId": "string",
"executionId": "string",
"jobStatus": {
"status": "INITIATED",
"error": "string"
},
"payload": {
"summary": ["string"],
"topics": ["string"],
"next_steps": ["string"],
"refs": [
{
"id": "string",
"displayText": "Raven GmbH",
"schema": "contact"
}
]
},
"createdAt": "1970-01-01T00:00:00.000Z",
"updatedAt": "1970-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',
})

spamThread​

Mark a thread as spam

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

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

unspamThread​

Remove spam marking from a thread

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

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

spamMessage​

Mark a single message as spam. Also marks the parent thread as spam if all messages in the thread are spam.

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

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

unspamMessage​

Remove spam marking from a single message. Also removes spam from the parent thread if no other messages are spam.

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

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

bulkMoveThreads​

Move many threads to a different inbox

POST /v1/message/threads/bulk:move

const { data } = await client.bulkMoveThreads(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531'],
assign_to: ['206801'],
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
scopes: ['organization', 'user']
},
)

bulkAssignThreads​

Assign many threads

POST /v1/message/threads/bulk:assign

const { data } = await client.bulkAssignThreads(
null,
{
ids: ['6b299eda-4018-4554-8965-c4b5598e6531'],
assign_to: ['206801'],
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
scopes: ['organization', 'user']
},
)

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'],
assign_to: ['206801'],
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
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'],
assign_to: ['206801'],
inbox_id: '3f34ce73-089c-4d45-a5ee-c161234e41c3',
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
}
],
)

dismissThreadLinkSuggestions​

Dismiss pending candidates of entity-link suggestions on a thread. A suggestion is recorded on a message when an identifier in it matched entities of different customers, so nothing was linked automat

POST /v1/message/threads/{id}/link-suggestions/dismiss

const { data } = await client.dismissThreadLinkSuggestions(
{
id: '123e4567-e89b-12d3-a456-426614174000',
},
{
suggestion_ids: ['string'],
entity_ids: ['string']
},
)
Response
{
"dismissed": ["string"]
}

unassignThread​

Unassign thread from entities

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

const { data } = await client.unassignThread(
{
id: '123e4567-e89b-12d3-a456-426614174000',
unlink_mapped_entities: true,
},
[
{
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",
"updated_by": "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,
"save_to_entity": true
}
]
},
"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",
"updated_by": "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,
"save_to_entity": true
}
]
},
"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
{
"link_suggestions": [
{
"id": "string",
"identifier": "string",
"found_in": "string",
"status": "pending",
"candidates": [],
"accepted_entity_ids": ["string"],
"resolved_by": {},
"resolved_at": "1970-01-01T00:00:00.000Z",
"created_at": "1970-01-01T00:00:00.000Z"
}
],
"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",
"updated_by": "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": [
{}
]
},
"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
updated_by?: 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
updated_by?: 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?: { ... }
}>
// ...
}

Message​

type Message = {
message_id?: string
sender?: string
updated_by?: 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?: { ... }
save_to_entity?: { ... }
}>
}
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
updated_by?: 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?: { ... }
save_to_entity?: { ... }
}>
}
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
save_to_entity?: 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
save_to_entity?: boolean
}

MessageRequestParams​

type MessageRequestParams = {
complete_thread?: boolean
mark_thread_as_read?: 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?: { ... }
save_to_entity?: { ... }
}>
}
template_id?: string
source?: "manual" | "automation" | "workflow" | "partner" | "bulk" | "system"
}

ThreadView​

A central-inbox view, described structurally so the server compiles the query for it. Both the thread list and the unread count for a view are compiled from the same description, so the two cannot disagree about what the view means.

Every field is optional and an omitted field adds no condition, so

type ThreadView = {
folder?: "inbox" | "favorite" | "sent" | "trash" | "spam" | "unassignable" | "draft"
mailbox?: "organization" | "agent"
labels?: string[]
purposes?: string[]
filters?: "unread" | "resolved" | "trash"[]
from?: string[]
to?: string[]
assigned_to?: string[]
include_unassigned?: boolean
date_from_days_ago?: number
date_to_days_ago?: number
email_filter?: string[]
text?: string
thread_ids?: string[]
pinned_by?: string
}

UnreadCountScope​

type UnreadCountScope = {
name: string
type: "organization" | "shared_inbox" | "saved_view"
q?: string
view_id?: string
inbox_id?: string | string[]
}

UnreadCountsPayload​

type UnreadCountsPayload = {
actor: "organization" | "user"
email_filter?: string[]
user_groups?: string[]
scopes: Array<{
name: string
type: "organization" | "shared_inbox" | "saved_view"
q?: string
view_id?: string
inbox_id?: string | string[]
}>
}

UnreadCountsResult​

type UnreadCountsResult = {
enabled: boolean
counts: Record<string, {
unread: number
drafts?: number
unassigned?: number
spam?: number
}>
omitted?: string[]
}

UnreadCountBuckets​

type UnreadCountBuckets = {
unread: number
drafts?: number
unassigned?: number
spam?: number
}

SearchParamsV2​

type SearchParamsV2 = {
inbox_id?: string | string[]
q?: string
view?: {
folder?: "inbox" | "favorite" | "sent" | "trash" | "spam" | "unassignable" | "draft"
mailbox?: "organization" | "agent"
labels?: string[]
purposes?: string[]
filters?: "unread" | "resolved" | "trash"[]
from?: string[]
to?: string[]
assigned_to?: string[]
include_unassigned?: boolean
date_from_days_ago?: number
date_to_days_ago?: number
email_filter?: string[]
text?: string
thread_ids?: string[]
pinned_by?: string
}
user_groups?: 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 = {
view?: {
folder?: "inbox" | "favorite" | "sent" | "trash" | "spam" | "unassignable" | "draft"
mailbox?: "organization" | "agent"
labels?: string[]
purposes?: string[]
filters?: "unread" | "resolved" | "trash"[]
from?: string[]
to?: string[]
assigned_to?: string[]
include_unassigned?: boolean
date_from_days_ago?: number
date_to_days_ago?: number
email_filter?: string[]
text?: string
thread_ids?: string[]
pinned_by?: string
}
user_groups?: string[]
inbox_id?: string | string[]
q?: string
}

AssigneeWorkloadParams​

type AssigneeWorkloadParams = {
user_ids: string[]
}

AssigneeWorkload​

type AssigneeWorkload = {
user_id: string
open_threads: number
}

AssigneeWorkloadResults​

type AssigneeWorkloadResults = {
workloads: Array<{
user_id: string
open_threads: number
}>
}

ReadMessagePayload​

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

ReadingScope​

Who is marking an item as read or unread.

type ReadingScope = "organization" | "user"

ThreadReplyContext​

type ThreadReplyContext = {
thread_id: string
topic?: string
reply_to_message_id?: string
messages: Array<{
id: string
created_at?: string // date-time
type: "RECEIVED" | "SENT"
role: "customer" | "agent" | "partner"
subject?: string
from?: {
address?: { ... }
name?: { ... }
}
text: string
}>
related_entities: Array<{
_id: string
_schema: string
}>
}

ReplyContextMessage​

type ReplyContextMessage = {
id: string
created_at?: string // date-time
type: "RECEIVED" | "SENT"
role: "customer" | "agent" | "partner"
subject?: string
from?: {
address?: string
name?: string
}
text: string
}

ReplyContextEntityRef​

type ReplyContextEntityRef = {
_id: string
_schema: string
}

ThreadSummary​

type ThreadSummary = {
orgId: string
jobId: string
executionId?: string
jobStatus: {
status: "INITIATED" | "IN_PROGRESS" | "COMPLETED" | "FAILED"
error?: string
}
payload?: {
summary?: string[]
topics?: string[]
next_steps?: string[]
refs?: Array<{
id: { ... }
displayText: { ... }
schema: { ... }
}>
}
createdAt: string // date-time
updatedAt: string // date-time
}

ThreadSummaryPayload​

Present once the summary is generated

type ThreadSummaryPayload = {
summary?: string[]
topics?: string[]
next_steps?: string[]
refs?: Array<{
id: string
displayText: string
schema: string
}>
}

ThreadSummaryEntityRef​

type ThreadSummaryEntityRef = {
id: string
displayText: string
schema: string
}

ThreadSummaryContext​

type ThreadSummaryContext = {
thread_id: string
message_id: string
subject: string
conversation: string
entity_context: string
}

SimilarSentMessagesRequest​

type SimilarSentMessagesRequest = {
queries: string[]
limit?: number
min_score?: number
}

SimilarSentMessagesResponse​

type SimilarSentMessagesResponse = {
results: Array<{
message_id: string
thread_id?: string
subject?: string
text: string
created_at?: string
score: number
}>
}

SimilarSentMessage​

type SimilarSentMessage = {
message_id: string
thread_id?: string
subject?: string
text: string
created_at?: string
score: number
}

ThreadTimeline​

type ThreadTimeline = {
events: Array<{
id?: string
data: {
type: { ... }
user_id: { ... }
organization_id: { ... }
} | {
type: { ... }
user_id: { ... }
organization_id: { ... }
} | {
type: { ... }
workflow_id?: { ... }
workflow_name?: { ... }
} | {
type: { ... }
added?: { ... }
removed?: { ... }
} | {
type: { ... }
label: { ... }
label_name?: { ... }
} | {
type: { ... }
label: { ... }
label_name?: { ... }
} | {
type: { ... }
entities?: { ... }
link_kind?: { ... }
from_suggestion?: { ... }
} | {
type: { ... }
entities?: { ... }
link_kind?: { ... }
} | {
type: { ... }
suggestions?: { ... }
} | {
type: { ... }
suggestions?: { ... }
} | {
type: { ... }
reply_message_id?: { ... }
parent_message_id?: { ... }
} | {
type: { ... }
target_inbox_id?: { ... }
target_inbox_name?: { ... }
} | {
type: { ... }
} | {
type: { ... }
}
timestamp: string
message_id?: string
source?: "user" | "automation" | "system"
automated?: boolean
actor?: {
user_id?: { ... }
email?: { ... }
}
automation?: {
id?: { ... }
name?: { ... }
}
}>
}

ThreadDoneEvent​

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

ThreadOpenEvent​

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

WorkflowStartedEvent​

type WorkflowStartedEvent = {
type: "WORKFLOW_STARTED"
workflow_id?: string
workflow_name?: string
}

ThreadUserAssignedEvent​

type ThreadUserAssignedEvent = {
type: "THREAD_USER_ASSIGNED"
added?: string[]
removed?: string[]
}

MessageLabelAddedEvent​

type MessageLabelAddedEvent = {
type: "MESSAGE_LABEL_ADDED"
label: string
label_name?: string
}

MessageLabelRemovedEvent​

type MessageLabelRemovedEvent = {
type: "MESSAGE_LABEL_REMOVED"
label: string
label_name?: string
}

MessageEntityLinkedEvent​

type MessageEntityLinkedEvent = {
type: "MESSAGE_ENTITY_LINKED"
entities?: Array<{
entity_id: string
schema?: string
}>
link_kind?: "manual" | "auto"
from_suggestion?: boolean
}

MessageEntityUnlinkedEvent​

type MessageEntityUnlinkedEvent = {
type: "MESSAGE_ENTITY_UNLINKED"
entities?: Array<{
entity_id: string
schema?: string
}>
link_kind?: "manual" | "auto"
}

MessageAutoReplySentEvent​

type MessageAutoReplySentEvent = {
type: "MESSAGE_AUTO_REPLY_SENT"
reply_message_id?: string
parent_message_id?: string
}

ThreadMovedToInboxEvent​

type ThreadMovedToInboxEvent = {
type: "THREAD_MOVED_TO_INBOX"
target_inbox_id?: string
target_inbox_name?: string
}

ThreadTrashedEvent​

type ThreadTrashedEvent = {
type: "THREAD_TRASHED"
}

ThreadRestoredEvent​

type ThreadRestoredEvent = {
type: "THREAD_RESTORED"
}

LinkSuggestionCandidate​

type LinkSuggestionCandidate = {
entity_id: string
schema: string
attribute?: string
attribute_value?: string
title?: string
status?: "pending" | "linked" | "dismissed"
resolved_by?: {
user_id?: string
email?: string
}
resolved_at?: string // date-time
}

LinkSuggestion​

type LinkSuggestion = {
id: string
identifier: string
found_in?: string
status: "pending" | "accepted" | "dismissed"
candidates: Array<{
entity_id: string
schema: string
attribute?: string
attribute_value?: string
title?: string
status?: "pending" | "linked" | "dismissed"
resolved_by?: {
user_id?: { ... }
email?: { ... }
}
resolved_at?: string // date-time
}>
accepted_entity_ids?: string[]
resolved_by?: {
user_id?: string
email?: string
}
resolved_at?: string // date-time
created_at?: string // date-time
}

TimelineLinkSuggestion​

type TimelineLinkSuggestion = {
id?: string
identifier: string
candidates?: Array<{
entity_id: string
schema?: string
}>
}

MessageEntityLinkSuggestedEvent​

type MessageEntityLinkSuggestedEvent = {
type: "MESSAGE_ENTITY_LINK_SUGGESTED"
suggestions?: Array<{
id?: string
identifier: string
candidates?: Array<{
entity_id: { ... }
schema?: { ... }
}>
}>
}

MessageEntityLinkSuggestionDismissedEvent​

type MessageEntityLinkSuggestionDismissedEvent = {
type: "MESSAGE_ENTITY_LINK_SUGGESTION_DISMISSED"
suggestions?: Array<{
id?: string
identifier: string
candidates?: Array<{
entity_id: { ... }
schema?: { ... }
}>
}>
}

TimelineLinkedEntity​

type TimelineLinkedEntity = {
entity_id: string
schema?: string
}

TimelineActor​

type TimelineActor = {
user_id?: string
email?: string
}

TimelineEventData​

type TimelineEventData = {
type: "THREAD_DONE"
user_id: string
organization_id: string
} | {
type: "THREAD_OPEN"
user_id: string
organization_id: string
} | {
type: "WORKFLOW_STARTED"
workflow_id?: string
workflow_name?: string
} | {
type: "THREAD_USER_ASSIGNED"
added?: string[]
removed?: string[]
} | {
type: "MESSAGE_LABEL_ADDED"
label: string
label_name?: string
} | {
type: "MESSAGE_LABEL_REMOVED"
label: string
label_name?: string
} | {
type: "MESSAGE_ENTITY_LINKED"
entities?: Array<{
entity_id: string
schema?: string
}>
link_kind?: "manual" | "auto"
from_suggestion?: boolean
} | {
type: "MESSAGE_ENTITY_UNLINKED"
entities?: Array<{
entity_id: string
schema?: string
}>
link_kind?: "manual" | "auto"
} | {
type: "MESSAGE_ENTITY_LINK_SUGGESTED"
suggestions?: Array<{
id?: string
identifier: string
candidates?: Array<{
entity_id: { ... }
schema?: { ... }
}>
}>
} | {
type: "MESSAGE_ENTITY_LINK_SUGGESTION_DISMISSED"
suggestions?: Array<{
id?: string
identifier: string
candidates?: Array<{
entity_id: { ... }
schema?: { ... }
}>
}>
} | {
type: "MESSAGE_AUTO_REPLY_SENT"
reply_message_id?: string
parent_message_id?: string
} | {
type: "THREAD_MOVED_TO_INBOX"
target_inbox_id?: string
target_inbox_name?: string
} | {
type: "THREAD_TRASHED"
} | {
type: "THREAD_RESTORED"
}

TimelineEvent​

type TimelineEvent = {
id?: string
data: {
type: "THREAD_DONE"
user_id: string
organization_id: string
} | {
type: "THREAD_OPEN"
user_id: string
organization_id: string
} | {
type: "WORKFLOW_STARTED"
workflow_id?: string
workflow_name?: string
} | {
type: "THREAD_USER_ASSIGNED"
added?: string[]
removed?: string[]
} | {
type: "MESSAGE_LABEL_ADDED"
label: string
label_name?: string
} | {
type: "MESSAGE_LABEL_REMOVED"
label: string
label_name?: string
} | {
type: "MESSAGE_ENTITY_LINKED"
entities?: Array<{
entity_id: { ... }
schema?: { ... }
}>
link_kind?: "manual" | "auto"
from_suggestion?: boolean
} | {
type: "MESSAGE_ENTITY_UNLINKED"
entities?: Array<{
entity_id: { ... }
schema?: { ... }
}>
link_kind?: "manual" | "auto"
} | {
type: "MESSAGE_ENTITY_LINK_SUGGESTED"
suggestions?: Array<{
id?: { ... }
identifier: { ... }
candidates?: { ... }
}>
} | {
type: "MESSAGE_ENTITY_LINK_SUGGESTION_DISMISSED"
suggestions?: Array<{
id?: { ... }
identifier: { ... }
candidates?: { ... }
}>
} | {
type: "MESSAGE_AUTO_REPLY_SENT"
reply_message_id?: string
parent_message_id?: string
} | {
type: "THREAD_MOVED_TO_INBOX"
target_inbox_id?: string
target_inbox_name?: string
} | {
type: "THREAD_TRASHED"
} | {
type: "THREAD_RESTORED"
}
timestamp: string
message_id?: string
source?: "user" | "automation" | "system"
automated?: boolean
actor?: {
user_id?: string
email?: string
}
automation?: {
id?: string
name?: string
}
}

BulkActionsPayloadWithScopes​

type BulkActionsPayloadWithScopes = {
ids: string[]
assign_to?: string[]
inbox_id?: 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[]