Closing a Conversation

For most use cases, we recommend never closing a conversation. Nothing is more frustrating than getting back to a chat and having the system prevent you from responding or following up.

However, there are many legitimate reasons to want to close a chat, so that people can't write additional messages.

TalkJS does not have an explicit "close chat" feature, but it does allow you to control the access rights of a user in a conversation. If you remove everybody's write access, they'll see that the text entry field is disabled, but they can still see what was discussed. That's effectively the same as closing a conversation.

To do this, use the REST API to send a PATCH call for every participant in a conversation, changing the access to "Read" instead of the default "ReadWrite". For example, for a conversation id "54321" has participants with user ids "1" and "5", you'd do these REST calls:

1curl https://api.talkjs.com/v1/YOUR_APP_ID/conversations/54321/participants/1 \
2-H "Content-Type: application/json" \
3-H "Authorization: Bearer YOUR_SECRET_KEY" \
4-X PATCH
5-d '{ "access": "Read" }'
6
7curl https://api.talkjs.com/v1/YOUR_APP_ID/conversations/54321/participants/5 \
8-H "Content-Type: application/json" \
9-H "Authorization: Bearer YOUR_SECRET_KEY" \
10-X PATCH
11-d '{ "access": "Read" }'

The REST API from the example above is documented here. User access rights are described in more detail under Access rights.

UI showing access no longer allowed