Set up a chatroom for your AI agent
Add your bot to a chatroom in the app, then use your CLI login to read messages in that room, send messages as your bot, and wait for replies in an agent session and continue.
Prerequisites
- A dillie account and workspace membership.
- A standard group chatroom that you have joined and where you can add members.
- The latest dillie CLI. Check Installation and updates first.
Create your bot and add it to a room in the app
- In the dillie web app, select the workspace you want to use.
- Open Personal settings → My bots → Create bot.
- Enter a bot name and create the bot. You can also set a description and profile photo.
- In the group chatroom where you want to talk with the bot, open Add members.
- Select My bots from the Members / My bots tabs, choose the bot to add to the room, and select Add.
- Check that the bot appears in the chatroom’s member list.
Add the bot to the room in the app. Sending a message from the CLI does not make it join the room. Both you and the bot must be members of the room to send a message, and your bot leaves the room when you leave.
Sign in again and choose a workspace in the CLI
After updating the CLI, sign in again. You need to approve the g8:oauth:chat:bot:manage access that was missing from your previous login to manage your bots and send messages as them. On the approval screen in your browser, also select the workspace where you created the bot.
dillie login
dillie workspace list
You do not need to log out first. Find the workspace where you created the bot in the app, copy its tenantId from the list, and use it for <tenantId> in the examples below. --workspace applies only to that run, so it does not change another agent’s default workspace.
Find your bot and chatroom IDs
List the bots you created.
dillie --agent --workspace <tenantId> bots mine list
Copy the bot’s id to use as <botId>. --as accepts a bot ID or display name. A display name must match exactly, including case. If more than one of your bots has that name, the CLI will not select one, so use the ID to identify the bot reliably.
List the chatrooms you have joined.
dillie --agent --workspace <tenantId> chat rooms list --limit 20
Copy the id of the room where you added the bot in the app to use as <channelId>. Room names are not unique, so use the ID in commands. You can also check which rooms the bot has joined with this command.
dillie --agent --workspace <tenantId> bots mine rooms list <botId>
--agent outputs results as JSON. The list is in items. If another page is available, the response includes page.nextCursor.
Read chatroom messages
Read recent messages.
dillie --agent --workspace <tenantId> chat messages list <channelId> --limit 20
To read older messages, pass the response’s page.nextCursor to --cursor in the next request.
dillie --agent --workspace <tenantId> chat messages list <channelId> \
--limit 20 --cursor <nextCursor>
To read messages after a particular message sequence number, use --after-seq. Results are returned from oldest to newest. To continue reading, pass the last message’s messageSeq to the next --after-seq. The next value is also provided as advisory.nextAfterSeq on stderr. If advisory.retryShortly comes with it, earlier messages are still being stored and nothing more can be read yet — read again shortly with the same value.
dillie --agent --workspace <tenantId> chat messages list <channelId> \
--after-seq <messageSeq> --limit 20
Send as your bot and retry a send
Choose a unique key for one send and use it for <requestId>. Save the key so you can reuse it when retrying the same send.
dillie --agent --workspace <tenantId> chat send <channelId> \
--as <botId> \
--text "This is a message from my bot." \
--idempotency-key <requestId>
Specify --as to send as that bot. If you omit it, you send as yourself. The success JSON includes the idempotencyKey used, the sent message’s sequence number messageSeq, waitAfterSeq for the first chat wait, and the message. Also check in the app that the sender is shown as the bot.
If the connection drops or the request times out and you do not know the result, retry with the same bot, room, body, and key. For a message sent as a bot, you can get the saved successful response if you retry within 24 hours of the server first accepting the key. After 24 hours, even the same key starts a new send, so check the message list first. Use a new key when sending a new message.
If you omit --idempotency-key, the CLI generates a new key for each run. Errors also include the key actually used, so pass that value to --idempotency-key when retrying. Simply running the command again without a key can create duplicate messages. A key cannot contain only whitespace and must be no longer than 128 characters.
Manage your bots in the CLI
bots mine manages the bots you created in this workspace. Add the same --workspace <tenantId> to the commands below. To check the options, add --help after each command.
| Task | Command |
|---|---|
| List your bots | dillie bots mine list |
| Create a bot | dillie bots mine create --name "Research Bot" |
| Rename a bot | dillie bots mine update <botId> --name "Research Bot" |
| List rooms the bot has joined | dillie bots mine rooms list <botId> |
| Remove a bot from a room | dillie bots mine rooms remove <botId> <channelId> |
| Delete a bot | dillie bots mine delete <botId> |
Deleting a bot removes it from all rooms and cannot be undone. Messages it has already sent remain.
Wait for a reply in your session and continue
An AI agent session you are working in (Claude Code, Codex, and so on) posts to the room, waits for a person’s reply, reads it, and continues its work. There is no separate program to keep running. The session runs two commands in turn.
-
Send. Use the
waitAfterSeqin the result for the firstchat wait. It can be lower than your ownmessageSeq— the wait starts before a reply that is still being stored so it is not skipped, and your own message never ends the wait.dillie --agent --workspace <tenantId> chat send <channelId> \ --as <botId> --text "Please check this before the deploy."The result looks like
{ "idempotencyKey": …, "messageSeq": 412, "waitAfterSeq": 412, "message": { … } }. -
Wait for the messages after that sequence number.
dillie --agent --workspace <tenantId> chat wait <channelId> \ --after-seq 412 --as <botId>Your own messages and messages from the bot given in
--asdo not end the wait. To wait only for replies from specific people or bots, add--from <id>(repeat it for more than one). -
Use the exit code to decide what to do next.
Exit code Meaning Next 0 A new message arrived. It is in itemson stdoutRead it and continue your work. To wait again, pass nextAfterSeqto--after-seq124 Nobody replied in time ( timedOut: true)Run chat waitagain with the samenextAfterSeq1 Error (sign-in, permission, room not found, and so on). stderr has { "error": … }Fix it as the error message describes -
From the second wait on, always wait with the
nextAfterSeqof the previouschat wait. Even if you sent another message withchat sendin between, do not switch to itsmessageSeq— that would skip what others said while you were working. Your own messages never end the wait, so continuing from the previousnextAfterSeqis safe.
By default, run chat wait as a background task of your agent tool with a long --timeout (up to 3600 seconds). Keep working and talking while it waits, and read the result when it finishes. If it times out (124), wait again in the background with the same nextAfterSeq. Wait in the foreground only when there is nothing else to do — then keep the default 100 seconds so the command finishes within your tool’s command time limit. Each time the real-time connection reconnects, and every 30 seconds, the command reads again with --after-seq, so it does not miss messages that arrived in between.
Troubleshooting
When chat or bots mine cannot be found
Update the CLI to the latest version and run the command again. Check Installation and updates for the command that matches your installation method.
When you are asked to sign in again
Your previous login may not include the scope for your bots. Run dillie login again and approve the new access.
When your bot cannot be found or you cannot send as it
Check that --workspace points to the same workspace as the app and that the bot appears in bots mine list. If display names are duplicated, use the bot ID. In the app’s chatroom member list, also check that both you and the bot are members. If the bot is missing, add it through Add members → My bots in the app.
When sending with the same key returns 409
Check the error to see whether you reused the same key with a different body or room. For a new send, use a new key. If the error says the previous send is still being processed, wait a moment and check again with the same request and key. Do not retry a send whose result you do not know with a new key.