Assistant chats
The conversations held with the assistant in the app.
Assistant chats tools
| Tool | What it does |
|---|---|
| listChats | The chats held with the assistant in the app, newest first, with their titles and how many messages each holds. query searches the titles. Returned a page at a time. |
| getChat | One chat by its id. |
| renameChat | Give a chat a new title. |
| deleteChat | Delete a chat and every message in it, for good. Nothing the assistant did in the mailbox is undone. |
| listChatMessages | The messages of one chat, from the first unless order is desc: what was said, and each tool the assistant called with its status and arguments. Returned a page at a time. |
| sendChatMessage | Say something in a chat and get the turn back once the assistant has replied. An id that names no chat yet starts one, and regenerate answers your last message again. Give the call a long timeout, since it answers only once the turn has ended. |
| stopChatTurn | Stop the assistant while it answers, in the app or through sendChatMessage, keeping what it had written. When nothing runs, nothing changes. |
| approveChatToolCall | Let the assistant run a call it waits for, with any args you pass laid over its own, and get the turn back once it has carried on. |
| denyChatToolCall | Refuse a call the assistant waits for. It is told, and carries on without it. |
Each person reaches only their own chats, through a client connected with every address. Reading needs threads:read and changing needs threads:write.
The assistant in the app does not have these tools, so a chat never renames or deletes itself.
A turn started here uses only the tools the client was given, and never one that asks for a verification code. A call that changes something waits for approveChatToolCall or denyChatToolCall, as it waits for your answer in the app.
Reference
listChats
The conversations held with the assistant in the Nextmail app, as its assistant panel lists them, newest first, each with its title, id and how many messages it holds. query searches the titles. Each person reaches only their own chats. One page at a time: when more follow, the last line gives a cursor to pass back for the next page.
Inputs
querystring- Up to 200 characters
sortstring- One of
"newest""oldest""title" limitinteger- At least 1At most 100
cursorstring- 1 to 2048 characters
Also available in
- API
GET /chats- TypeScript
chats.list()chats.listAll()chats.iterate()- Python
chats.list()chats.list_all()chats.iterate()- Ruby
chats.listchats.list_allchats.iterate- PHP
chats->listchats->listAllchats->iterate- Go
Chats.ListChats.ListAllChats.Iterate- Java
chats().listchats().listAllchats().iterate- C#
Chats.ListAsyncChats.ListAllAsyncChats.IterateAsync
getChat
One chat with the assistant by its id: its title, how many messages it holds and when it last changed.
Inputs
idstringRequired- Not empty
Also available in
- API
GET /chats/{id}- TypeScript
chats.get()- Python
chats.get()- Ruby
chats.get- PHP
chats->get- Go
Chats.Get- Java
chats().get- C#
Chats.GetAsync
renameChat
Give a chat with the assistant a new title.
Inputs
idstringRequired- Not empty
titlestringRequired- 1 to 120 characters
Also available in
- API
PATCH /chats/{id}- TypeScript
chats.rename()- Python
chats.rename()- Ruby
chats.rename- PHP
chats->rename- Go
Chats.Rename- Java
chats().rename- C#
Chats.RenameAsync
deleteChat
Delete a chat with the assistant and every message in it, for good. Nothing it did in the mailbox is undone. Ask the person first.
Inputs
idstringRequired- Not empty
Also available in
- API
DELETE /chats/{id}- TypeScript
chats.delete()- Python
chats.delete()- Ruby
chats.delete- PHP
chats->delete- Go
Chats.Delete- Java
chats().delete- C#
Chats.DeleteAsync
listChatMessages
The messages of one chat with the assistant, from the first unless order is desc: what was said, and each tool the assistant called with its status and arguments. Each person reaches only their own chats. One page at a time: when more follow, the last line gives a cursor to pass back for the next page.
Inputs
chatIdstringRequiredThe chat, as listChats names it.
1 to 64 characterslimitinteger- At least 1At most 50
cursorstring- 1 to 2048 characters
orderstringascreads the chat from its first message, anddescfrom its newest.One of"asc""desc"
Also available in
- API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny- TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()- Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()- Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call- PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall- Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall- Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall- C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync
sendChatMessage
Say something to the assistant in one of its chats in the Nextmail app, and get the turn back once it has replied: its status, your message and the replies, and each tool call it waits for. A chatId that names no chat yet starts one, and regenerate answers your last message again instead. The assistant answers with the tools the permissions of this client reach. A tool that asks for a verification code is never offered, and a tool that changes something waits for an answer: the turn ends with the status awaiting_approval and lists each call it waits for, and approveChatToolCall or denyChatToolCall answers it. A call you asked for in so many words runs without waiting, as it does in the app. The answer comes back once the turn has ended, so give this call a long timeout. A turn runs for at most 240 seconds. Past that it stops with stopReason time_limit and keeps what it had written. One turn runs in a chat at a time.
Inputs
chatIdstringRequiredThe chat, as listChats names it, or a new id of at most 64 characters to start one.
1 to 64 characterscontentstringWhat you say to the assistant. Required unless
regenerateis true.1 to 32000 charactersregeneratebooleanAnswer your last message again instead of sending a new one. The reply it had is replaced.
messageIdstringAn id for your message, unique in this chat. Left out, one is made up.
1 to 64 charactersattachmentsobject[]Up to 4 files for the assistant to read:
{ "fileId": id }for a file in Files, or{ "filename", "content", "contentType" }for a text file of at most 256 KiB, its content in base64.Up to 4 itemsfileIdstringRequired- 1 to 128 characters
threadIdstringA conversation the chat is about. It is pinned to the chat with its first message, and the assistant reads it before it answers.
1 to 255 characterstemplateIdstringA template the assistant should work on, as the template editor of the app passes it.
1 to 128 characters
Also available in
- API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny- TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()- Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()- Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call- PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall- Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall- Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall- C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync
stopChatTurn
Stop the assistant while it answers in a chat, in the app or through sendChatMessage, keeping what it had written. A tool call that had not returned is marked interrupted. When nothing runs, nothing changes and the answer says so.
Inputs
chatIdstringRequiredThe chat, as listChats names it.
1 to 64 charactersturnIdstringStops the turn only while it is this one, as
turnIdof a chat turn names it.1 to 128 characters
Also available in
- API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny- TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()- Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()- Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call- PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall- Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall- Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall- C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync
approveChatToolCall
Let the assistant run a tool call it waits for in a chat, with the arguments the call shows and any args you pass laid over them, and get the turn back once the assistant has carried on. When it waits for several calls, it carries on once every one is answered. Ask the person first: the call does what the assistant asked, such as sending an email. The answer comes back once the turn has ended, so give this call a long timeout. A turn runs for at most 240 seconds. Past that it stops with stopReason time_limit and keeps what it had written. One turn runs in a chat at a time.
Inputs
chatIdstringRequiredThe chat, as listChats names it.
1 to 64 characterstoolCallIdstringRequiredThe tool call, as the turn that waits for it lists it.
1 to 128 charactersargsRecord<string, any>Arguments to change before the call runs, laid over the ones the assistant chose. Left out, the call runs as asked.
Also available in
- API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny- TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()- Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()- Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call- PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall- Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall- Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall- C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync
denyChatToolCall
Refuse a tool call the assistant waits for in a chat. The assistant is told, and carries on without it once every call it waits for is answered, and the turn comes back as it does from sendChatMessage. The answer comes back once the turn has ended, so give this call a long timeout. A turn runs for at most 240 seconds. Past that it stops with stopReason time_limit and keeps what it had written. One turn runs in a chat at a time.
Inputs
chatIdstringRequiredThe chat, as listChats names it.
1 to 64 characterstoolCallIdstringRequiredThe tool call, as the turn that waits for it lists it.
1 to 128 characters
Also available in
- API
GET /chats/{id}/messagesPOST /chats/{id}/messagesPOST /chats/{id}/stopPOST /chats/{id}/tool-calls/{toolCallId}/approvePOST /chats/{id}/tool-calls/{toolCallId}/deny- TypeScript
chats.listMessages()chats.listAllMessages()chats.iterateMessages()chats.sendMessage()chats.stopTurn()chats.approveToolCall()chats.denyToolCall()- Python
chats.list_messages()chats.list_all_messages()chats.iterate_messages()chats.send_message()chats.stop_turn()chats.approve_tool_call()chats.deny_tool_call()- Ruby
chats.list_messageschats.list_all_messageschats.iterate_messageschats.send_messagechats.stop_turnchats.approve_tool_callchats.deny_tool_call- PHP
chats->listMessageschats->listAllMessageschats->iterateMessageschats->sendMessagechats->stopTurnchats->approveToolCallchats->denyToolCall- Go
Chats.ListMessagesChats.ListAllMessagesChats.IterateMessagesChats.SendMessageChats.StopTurnChats.ApproveToolCallChats.DenyToolCall- Java
chats().listMessageschats().listAllMessageschats().iterateMessageschats().sendMessagechats().stopTurnchats().approveToolCallchats().denyToolCall- C#
Chats.ListMessagesAsyncChats.ListAllMessagesAsyncChats.IterateMessagesAsyncChats.SendMessageAsyncChats.StopTurnAsyncChats.ApproveToolCallAsyncChats.DenyToolCallAsync