Doku durchsuchen
Menü
Geändert am Auf GitHub bearbeiten

Konsole: chat

Als Markdown kopieren

Diese Routen liegen auf der Konsole, Port 3375. Sie nehmen ein API-Token als Authorization: Bearer ndt_...; siehe API-Tokens. Die Beschreibungen stehen auf Englisch, wie in der OpenAPI-Beschreibung.

The chat: support conversations with the people at the computers (chat.support), the team chat between colleagues (chat.team), canned replies and the chat's settings. The messages themselves go over the chat's WebSocket.

GET /api/chat/canned

List the shared canned replies and your own.

Ordered by title.

Needs chat.support or chat.team. neodesk chat canned calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
replies array of ChatCannedReply yes
may_manage_shared boolean yes The account has chat.canned_manage
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

POST /api/chat/canned

Add a canned reply (-f title=..., -f body=..., -F shared=true needs chat.canned_manage).

A shared reply needs chat.canned_manage.

Needs chat.support or chat.team. neodesk chat canned-add calls it.

Request body, application/json:

Field Type Required What it is
title string yes Cut to 80 characters
body string yes Cut to 4096 characters
shared boolean Every account sees it; default false

200: Done (application/json)

Field Type Required
success true yes
reply ChatCannedReply yes
Error When
400 No title or no text
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account lacks chat.support and chat.team, or chat.canned_manage for a shared reply

PATCH /api/chat/canned/{id}

Change a canned reply.

An account changes its own replies, and shared ones with chat.canned_manage. Both fields are written.

Needs chat.support or chat.team. neodesk chat canned-set calls it.

Parameter In Type Required What it is
id path integer yes The reply's id (see chat canned)

Request body, application/json:

Field Type Required What it is
title string yes Cut to 80 characters
body string yes Cut to 4096 characters

200: Done (application/json)

Field Type Required
success true yes
reply ChatCannedReply yes
Error When
400 No title or no text
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account lacks chat.support and chat.team, or chat.canned_manage for a shared reply
404 There is no such reply, or it is another account's

DELETE /api/chat/canned/{id}

Delete a canned reply.

An account deletes its own replies, and shared ones with chat.canned_manage.

Needs chat.support or chat.team. neodesk chat canned-remove calls it.

Parameter In Type Required What it is
id path integer yes The reply's id (see chat canned)

200: Done (application/json)

ConsoleSuccess.

Error When
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account lacks chat.support and chat.team, or chat.canned_manage for a shared reply
404 There is no such reply, or it is another account's

GET /api/chat/conversations/{id}

Show a conversation with its computer or its people.

A support conversation comes with its computer and the Support chat users who see it (assignable); a direct, group or team conversation with its people, and a team also with the names of its user groups.

Needs chat.support or chat.team. neodesk chat conversation calls it.

Parameter In Type Required What it is
id path string yes The conversation: a device ID for support, dm:<id>:<id>, group:<id> or team:<id>

200: Done (application/json)

Field Type Required What it is
success true yes
conversation ChatConversation yes
device ChatDevice
assignable array of ChatPerson Support only: who the conversation can be given to
people array of ChatPerson Not for support: the members
groups array of string Teams only: the names of its user groups
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 conversation, or the account does not read it

POST /api/chat/conversations/{id}/assign

Give a support conversation to a colleague (-F account_id=N, 0 for nobody); needs chat.assign too.

Needs chat.assign too. The new assignee must see the computer. The one who had the conversation before is told, and the conversation gets a line of the system. Giving it to whoever has it changes nothing.

Needs chat.support. neodesk chat assign calls it.

Parameter In Type Required What it is
id path string yes The device ID, which is the id of its support conversation

Request body, application/json:

Field Type What it is
account_id integer The colleague's account id; 0 or left out for nobody; default 0

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation yes
Error When
400 account_id is no number, or that person cannot see this computer
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account lacks chat.support or chat.assign
404 There is no such conversation, or the account does not read it

POST /api/chat/conversations/{id}/close

Close a support conversation (-f note=..., -F resolve_help_request=true).

The assignee or an account with chat.assign may close it. With resolve_help_request the computer's pending and acknowledged help requests are resolved too.

Needs chat.support. neodesk chat close calls it.

Parameter In Type Required What it is
id path string yes The device ID, which is the id of its support conversation

Request body, application/json:

Field Type What it is
note string A closing note, cut to 1000 characters
resolve_help_request boolean default false

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation yes
help_requests_resolved integer yes
Error When
400 The request is not valid
401 No session or API token, or one that is not valid (code session_required or token_invalid)
403 The account lacks chat.support, or is not the assignee and lacks chat.assign
404 There is no such conversation, or the account does not read it

POST /api/chat/conversations/{id}/link

Link a support conversation to a ticket or help request (-F ticket_id=N, -F help_request_id=N).

A field left out or 0 keeps that link as it is; a link cannot be removed. The route does not check that the ticket or help request exists. The answer leaves out assignee_name.

Needs chat.support. neodesk chat link calls it.

Parameter In Type Required What it is
id path string yes The device ID, which is the id of its support conversation

Request body, application/json:

Field Type What it is
ticket_id integer The ticket number; default 0, at least 0
help_request_id integer The help request's number; default 0, at least 0

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation yes
Error When
400 The request is not valid
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 conversation, or the account does not read it

POST /api/chat/conversations/{id}/reopen

Open a closed support conversation again.

The conversation gets a line of the system, also when it was open already.

Needs chat.support. neodesk chat reopen calls it.

Parameter In Type Required What it is
id path string yes The device ID, which is the id of its support conversation

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation 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 conversation, or the account does not read it

GET /api/chat/devices

Find computers to start a support conversation with (-f q=name, ID, host name, owner or folder).

Gives up to 20 computers the account sees, online ones first, then by name.

Needs chat.support. neodesk chat devices calls it.

Parameter In Type What it is
q query string Text in the name, ID, host name, owner or folder; case does not count

200: Done (application/json)

Field Type Required What it is
success true yes
devices array of ChatDevice yes at most 20 items
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

GET /api/chat/files/{fileId}

Download a file sent in a chat (use --output).

Answers the file as a download, with the content type of its extension. Only an account that may read a conversation the file was sent in gets it.

Needs chat.support or chat.team. neodesk chat file calls it.

Parameter In Type Required What it is
fileId path string yes The file's id: 32 hex digits, the last part of the attachment's url
inline query string, one of 1 1 sends a picture to show in the page; any other file still comes as a download

200: The file (application/octet-stream)

String (binary).

Error When
400 The id is not 32 hex digits
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 file, or the account may not download it

GET /api/chat/inbox

List support conversations: open (the default), mine or closed (-f filter=...), optionally matching -f q=.

Lists the support conversations of the computers the account sees, newest first, with the counts of each filter. open lists the conversations nobody took first. At most 2000 conversations are looked at.

Needs chat.support. neodesk chat inbox calls it.

Parameter In Type What it is
filter query string, one of open, mine, closed mine: open ones the account took; default "open"
q query string Text in the computer's name, ID, host name, owner or folder; case does not count

200: Done (application/json)

Field Type Required
success true yes
conversations array of ChatConversation and object yes
counts object yes
counts.open integer yes
counts.mine integer yes
counts.closed integer yes
counts.unassigned 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

GET /api/chat/me

Show your chat notifications (browser, sound, mail).

Until the account changes them, browser notifications and mail are on and sound is off.

Needs chat.support or chat.team. neodesk chat notifications calls it.

200: Done (application/json)

Field Type Required
success true yes
settings object yes
settings.browser boolean yes
settings.sound boolean yes
settings.mail boolean 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

PUT /api/chat/me

Change your chat notifications (-F browser=true -F sound=false -F mail=true).

Writes all three: a field left out is off.

Needs chat.support or chat.team. neodesk chat notifications-set calls it.

Request body, application/json:

Field Type What it is
browser boolean default false
sound boolean default false
mail boolean default false

200: Done (application/json)

Field Type Required
success true yes
settings object yes
settings.browser boolean yes
settings.sound boolean yes
settings.mail boolean yes
Error When
400 The request is not valid
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

GET /api/chat/messages/{id}/trail

Show the earlier texts of an edited or deleted chat message.

Only for messages of a conversation the account reads. Oldest first.

Needs audit.view. neodesk chat trail calls it.

Parameter In Type Required What it is
id path integer yes The message id

200: Done (application/json)

Field Type Required What it is
success true yes
trail array of object yes
trail[].action string, one of edit, delete yes
trail[].actor ChatParty yes
trail[].old_text string yes The text before the change
trail[].old_attachments array of object The files a deleted message had; left out for none
trail[].old_attachments[].id string yes
trail[].old_attachments[].name string yes
trail[].old_attachments[].type string yes
trail[].old_attachments[].size integer yes
trail[].old_attachments[].width integer
trail[].old_attachments[].height integer
trail[].at string (date-time) 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 message, or the account does not read its conversation

Find messages by their text in the conversations you read (-f q=text, two characters at least; -f section=support or team; -f conversation_id=...).

Finds up to 50 messages, newest first, in the conversations the account reads: support conversations of the computers it sees (with chat.support), its direct, group and team conversations (with chat.team), and for admins the history of the first chat. Deleted messages and lines of the system are not found. Case does not count for Latin letters; % and _ are plain text. A text shorter than two characters finds nothing.

Needs chat.support or chat.team. neodesk chat search calls it.

Parameter In Type What it is
q query string The text to find: two characters at least, cut to 200
section query string, one of support, team Only this part of the chat
conversation_id query string Only this conversation

200: Done (application/json)

Field Type Required What it is
success true yes
messages array of ChatMessage yes at most 50 items
conversations object yes The conversations of the messages, by id
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

GET /api/chat/settings

Show when the chat mails about a waiting person, whether the mail quotes it, and whether computers may open the chat.

Until an admin changes them: mail after 15 minutes, with the preview, and computers may open the chat.

Needs chat.support or chat.team. neodesk chat settings calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
settings object yes
settings.mail_after_minutes integer yes How long a person waits for an answer before the console mails; 0 is never
settings.mail_preview boolean yes The mail quotes the start of the waiting message
settings.computers boolean yes Computers may open the chat
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

PUT /api/chat/settings

Change the chat's mail (-F mail_after_minutes=15, 0 is off; -F mail_preview=false) and chat with computers (-F computers=false turns it off; left out keeps it).

mail_after_minutes and mail_preview are always written: left out they are 0 and false. computers left out keeps its setting. Writes an audit entry; turning computers off or on tells the open chats.

Needs server.config. neodesk chat settings-set calls it.

Request body, application/json:

Field Type What it is
mail_after_minutes integer 0 is never; default 0, at least 0, at most 10080
mail_preview boolean default false
computers boolean Left out keeps it

200: Done (application/json)

Field Type Required What it is
success true yes
settings object yes
settings.mail_after_minutes integer yes How long a person waits for an answer before the console mails; 0 is never
settings.mail_preview boolean yes The mail quotes the start of the waiting message
settings.computers boolean yes Computers may open the chat
Error When
400 mail_after_minutes is not between 0 and 10080
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

GET /api/chat/summary

Count unread support and team messages.

support is there with chat.support: the open conversations that are the account's or nobody's and have unread messages, and how many of the ones nobody took wait for an answer. team is there with chat.team: the unread messages of the account's direct, group and team conversations.

Needs chat.support or chat.team. neodesk chat summary calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
support object
support.unread_conversations integer yes
support.waiting integer yes
support.unread object yes Unread messages by conversation id
team object
team.unread integer yes
team.by_conversation object yes Unread messages by conversation id
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

GET /api/chat/team

List your direct, group and team conversations and the colleagues you can write to.

old is there for admins only, when the first chat left history that belongs to no two accounts.

Needs chat.team. neodesk chat team calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
conversations array of ChatConversation and object yes
people array of ChatPerson yes The colleagues with Team chat, by name
old array of ChatConversation and object History of the first chat, for admins
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

POST /api/chat/team/direct

Open the direct conversation with a colleague (-F account_id=N).

Makes the conversation when it is missing. The colleague must have Team chat.

Needs chat.team. neodesk chat direct calls it.

Request body, application/json:

Field Type Required What it is
account_id integer yes The colleague's account id

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation yes
Error When
400 account_id is no number, or the account cannot write to that person
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

POST /api/chat/team/groups

Make a group of colleagues (-f title=..., -F members='[2,3]').

The account is a member too. Every member must have Team chat.

Needs chat.team. neodesk chat group-add calls it.

Request body, application/json:

Field Type Required What it is
title string yes Cut to 120 characters
members array of integer yes Account ids; at most 200 items

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation yes
Error When
400 No name or no people, more than 200, or someone who does not have Team chat
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

PATCH /api/chat/team/groups/{id}

Rename a group or change its members.

Any member may change the group. An empty or missing title keeps the name; members left out or empty keeps the members, a list replaces them.

Needs chat.team. neodesk chat group-set calls it.

Parameter In Type Required What it is
id path string yes The group: group:<id>

Request body, application/json:

Field Type What it is
title string Cut to 120 characters
members array of integer Account ids, each with Team chat; at most 200 items

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation yes
Error When
400 More than 200 people, or someone who does not have Team chat
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 group, or the account is not in it

GET /api/chat/team/teams

List every team with its people and user groups, and the user groups a team can include.

Needs chat.team and chat.teams_manage. neodesk chat teams calls it.

200: Done (application/json)

Field Type Required What it is
success true yes
teams array of ChatConversation and object yes
user_groups array of object yes
user_groups[].guid string yes
user_groups[].name string yes
user_groups[].members array of integer yes Account ids
people array of ChatPerson yes The accounts with Team chat
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

POST /api/chat/team/teams

Make a team (-f title=..., -F people='[2,3]', -F groups='["<user group guid>"]').

Writes an audit entry and tells the members.

Needs chat.team and chat.teams_manage. neodesk chat team-add calls it.

Request body, application/json:

Field Type Required What it is
title string yes Cut to 120 characters
people array of integer Account ids, each with Team chat; at most 500 items
groups array of string User group GUIDs whose members are in the team; at most 100 items

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation yes
Error When
400 No name, too many people or user groups, someone without Team chat, or a user group that does not exist
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

PATCH /api/chat/team/teams/{id}

Rename a team or change its people and user groups.

Writes an audit entry. People who leave the team lose the conversation.

Needs chat.team and chat.teams_manage. neodesk chat team-set calls it.

Parameter In Type Required What it is
id path string yes The team: team:<id>

Request body, application/json:

Field Type What it is
title string Cut to 120 characters; empty or left out keeps the name
people array of integer Account ids, each with Team chat; left out keeps them; at most 500 items
groups array of string User group GUIDs whose members are in the team; left out keeps them; at most 100 items

200: Done (application/json)

Field Type Required
success true yes
conversation ChatConversation yes
Error When
400 Too many people or user groups, someone without Team chat, or a user group that does not exist
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 team

DELETE /api/chat/team/teams/{id}

Delete a team with its messages.

Deletes the team with its messages and writes an audit entry.

Needs chat.team and chat.teams_manage. neodesk chat team-delete calls it.

Parameter In Type Required What it is
id path string yes The team: team:<id>

200: Done (application/json)

ConsoleSuccess.

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 team

Durchsucht Seiten, Abschnitte, Befehle und Einstellungen.