Search the docs
Menu
Updated Edit on GitHub

Console: mail-intake

Copy as Markdown

These routes are on the console, port 3375. They take an API token as Authorization: Bearer ndt_...; see API tokens.

Tickets by mail: the mailboxes the server reads, their test and their log.

GET /api/integrations/mail-intake/mailboxes

List the mailboxes, with the password masked and how the last poll went.

Oldest first.

Needs server.config. neodesk mail-intake list calls it.

200: Done (application/json)

Field Type Required
success true yes
data object yes
data.mailboxes array of MailIntakeMailbox yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
500 Something failed on the server (the text of errors.server_error)
503 The mail intake is not available on this server

POST /api/integrations/mail-intake/mailboxes

Add a mailbox the server reads over IMAP.

A mail to it opens a ticket, a reply becomes a comment. Every mailbox that is on is read once a minute. The first poll only notes where the folder ends: the mail that is there before opens no tickets. Writes mail_intake_created to the audit log.

Needs server.config. neodesk mail-intake create calls it.

Request body, application/json:

MailIntakeMailboxInput.

200: The mailbox as stored (application/json)

Field Type Required
success true yes
data MailIntakeMailbox yes
Error When
400 The body is not a valid mailbox, or a field is missing or not valid: code is then invalid_ and the field's name, such as invalid_address, invalid_host or invalid_password
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
500 Something failed on the server (the text of errors.server_error)
503 The mail intake is not available on this server, or the server can't store the password because the key file for integrations could not be loaded

GET /api/integrations/mail-intake/mailboxes/{id}

Show one mailbox, with the password masked.

Needs server.config. neodesk mail-intake show calls it.

Parameter In Type Required What it is
id path string yes The mailbox's ID (see mail-intake list)

200: Done (application/json)

Field Type Required
success true yes
data MailIntakeMailbox yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such mailbox
500 Something failed on the server (the text of errors.server_error)
503 The mail intake is not available on this server

PATCH /api/integrations/mail-intake/mailboxes/{id}

Change a mailbox.

Give the fields to change; a password sent as ******** stays as it is. Another host, user name or folder is read from its end again, like a new mailbox. Writes mail_intake_changed, mail_intake_enabled or mail_intake_disabled to the audit log when something changed.

Needs server.config. neodesk mail-intake update calls it.

Parameter In Type Required What it is
id path string yes The mailbox's ID (see mail-intake list)

Request body, application/json:

MailIntakeMailboxInput.

200: The mailbox as stored (application/json)

Field Type Required
success true yes
data MailIntakeMailbox yes
Error When
400 The body is not a valid mailbox, or a field is not valid: code is then invalid_ and the field's name, such as invalid_host or invalid_password
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such mailbox
500 Something failed on the server (the text of errors.server_error)
503 The mail intake is not available on this server, or the server can't store the password because the key file for integrations could not be loaded

DELETE /api/integrations/mail-intake/mailboxes/{id}

Delete a mailbox.

Its tickets stay, but get no more mails. The log of its mails stays. Writes mail_intake_deleted to the audit log.

Needs server.config. neodesk mail-intake delete calls it. It cannot be undone.

Parameter In Type Required What it is
id path string yes The mailbox's ID (see mail-intake list)

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.deleted string yes The ID of the mailbox deleted
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such mailbox
500 Something failed on the server (the text of errors.server_error)
503 The mail intake is not available on this server

GET /api/integrations/mail-intake/mailboxes/{id}/log

List the newest mails a mailbox read and sent: what became of each and why.

Newest first.

Needs server.config. neodesk mail-intake log calls it.

Parameter In Type Required What it is
id path string yes The mailbox's ID (see mail-intake list)
limit query integer How many, at most 500; 100 when left out, 0 or more than 500; default 100, at most 500

200: Done (application/json)

Field Type Required
success true yes
data object yes
data.messages array of MailIntakeMessage yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such mailbox
500 Something failed on the server (the text of errors.server_error)
503 The mail intake is not available on this server

POST /api/integrations/mail-intake/mailboxes/{id}/run

Read a mailbox's new mails now instead of waiting for the next poll.

Also for a mailbox that is off. A poll that fails answers 200 with ok false and what the mail server said. Writes mail_intake_run to the audit log.

Needs server.config. neodesk mail-intake run calls it.

Parameter In Type Required What it is
id path string yes The mailbox's ID (see mail-intake list)

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.ok boolean yes
data.error string Only when ok is false: what the mail server said
data.result object yes What the poll did
data.result.started boolean yes The poll only noted where the folder ends: the first poll of a mailbox, or the first after its folder was rebuilt
data.result.tickets integer yes Mails that opened a ticket
data.result.comments integer yes Mails that became a comment
data.result.ignored integer yes
data.result.failed integer yes
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such mailbox
409 The mailbox is being read right now (code busy)
500 Something failed on the server (the text of errors.server_error)
503 The mail intake is not available on this server

POST /api/integrations/mail-intake/mailboxes/{id}/test

Connect to a mailbox, sign in and open its folder.

Gives up after a minute. A test that fails answers 200 with ok false and the mail server's words. Writes mail_intake_tested to the audit log.

Needs server.config. neodesk mail-intake test calls it.

Parameter In Type Required What it is
id path string yes The mailbox's ID (see mail-intake list)

200: Done (application/json)

Field Type Required What it is
success true yes
data object yes
data.ok boolean yes
data.error string Only when ok is false: what failed, in the mail server's words
data.messages integer yes The number of mails in the folder
Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account or the token may not do this, or a write from a browser came without a good CSRF token
404 There is no such mailbox
500 Something failed on the server (the text of errors.server_error)
503 The mail intake is not available on this server

Type to search pages, sections, commands and settings.