Skip to content

Shared chats and membership

Use this reference with the complete developer tour and Go types. The example at the end runs after the tour setup.

Create one shared conversation for the chosen participants and its first message.

func (c *Client) StartChat(ctx context.Context, in StartChatInput, key string) (SendResult, error)
Parameter Type and default Usage
ctx context.Context (required) Required Go context. Cancellation bounds this local call; it does not withdraw a durable request.
in StartChatInput (required) Typed operation input. Every field is listed in the language types reference.
key string (required) Saved idempotency key. Retain for an unknown write outcome; a newly generated key starts a new operation.

Returns: SendResult; an approval or choices on the first message also creates a requested decision.

Permissions, lifecycle and errors: Participants share the history they can currently access. Use individual targets with mutual view permission. Mentions address members without hiding messages from others.

Working Go example. Input/output fields are in the types reference.

Read a currently authorized conversation and its visible history.

func (c *Client) Conversation(ctx context.Context, id string) (json.RawMessage, error)
Parameter Type and default Usage
ctx context.Context (required) Required Go context. Cancellation bounds this local call; it does not withdraw a durable request.
id string (required) Existing stable resource ID, returned by the corresponding create/read operation.

Returns: Conversation with participants, messages, shared, version, manager_id and history_start where applicable.

Permissions, lifecycle and errors: New members normally see future history only. Current removal or policy changes can revoke messages and files. Conversation version controls membership changes, not request decisions.

Working Go example. Input/output fields are in the types reference.

Add or remove members, rename, leave, or transfer management of a shared chat.

func (c *Client) ChangeChatMembership(ctx context.Context, conversationID string, in ChatMembershipInput, key string) (ChatMembershipResult, error)
Parameter Type and default Usage
ctx context.Context (required) Required Go context. Cancellation bounds this local call; it does not withdraw a durable request.
conversationID string (required) Canonical conversation ID. Use it to continue the same authorized history.
in ChatMembershipInput (required) Typed operation input. Every field is listed in the language types reference.
key string (required) Saved idempotency key. Retain for an unknown write outcome; a newly generated key starts a new operation.

Returns: ChatMembershipResult: conversation_id, version, and optional left.

Permissions, lifecycle and errors: operation is add/remove/rename/leave. members contains principal IDs. share_history defaults false and must be an intentional disclosure. On leave or removal of the manager, supply next_manager when required. Refetch version on conflict.

Working Go example. Input/output fields are in the types reference.

Run this region after the shared setup. Assertions check the returned data; the full tour is a runnable program.

chat := must(owner.StartChat(ctx, beepgrid.StartChatInput{Targets: targets, Body: "👋 @Billing 2 check these orders.", Mentions: []beepgrid.Mention{{PrincipalID: billingID, Start: 2, End: 12}}}, runID+"/chat"))
check(chat.Messages[0].AttentionFor(billingID) != "")
history := decoded(must(owner.Conversation(ctx, chat.ConversationID)))
version := int(history["version"].(float64))
changed := must(owner.ChangeChatMembership(ctx, chat.ConversationID, beepgrid.ChatMembershipInput{Operation: "rename", Version: version, Title: "Checkout reconciliation"}, runID+"/rename"))
check(changed.Version > version)

Read this page as Markdown