Skip to main content

Code channel properties

Code channels contain structured properties that your app reads via the conversations.info API method under channel.properties and writes via the agents.conversations.setProperties API method (and related methods).

agent_session​

This property is present on every code channel. It identifies the channel as an agent session and tracks its state.

PropertyTypeDescription
statusstringSession status: active, processing, suspended, or closed. Set via the agents.sessions.setStatus API method.
encoded_agent_bot_user_idsstring[]Bot user IDs of the agent(s) assigned to this channel.
titlestringDisplay title of the session. Set via the agents.sessions.rename API method.
origin_linkobjectWhere the session started: { "channel_id": "C…", "ts": "1234567890.123456" }. Present when the session was started from a message.

Session statuses​

Refer to the agents.sessions.setStatus API method page for details.

code_channel​

Code-specific state for the channel. Your app sets context_bar_items and summary_message via setProperties. The remaining properties are recorded by the agents.conversations.setView API method as your app uses them.

This property is present on every code channel from the moment it is created, as {} until something writes to it. Don't use it to decide whether a channel is a code channel. Refer to recognizing a code channel.

PropertyTypeDescription
context_bar_itemsobject[]Items displayed in the channel context bar. Maximum 5 items.
summary_messageobjectRecords which message in the channel represents the current summary.

summary_message​

The summary_message sub-property lets your agent record which message in the code channel represents the current session summary. Clients can use the timestamps to fetch and display the summary. Set it via the agents.conversations.setProperties API method as code_channel.summary_message.

PropertyTypeRequiredDescription
message_tsstringRequiredTimestamp of the summary message in the code channel.
thread_tsstringOptionalIf the summary is a thread reply, the parent message timestamp.

When the agents.conversations.archive API method is called with the summary_message_ts property, the handler persists the value as a summary_message channel property before archiving, so the summary remains discoverable after archival.

Managed properties​

The following code_channel properties are maintained by Slack on behalf of your app. Yu read them, but don't set them directly via the agents.conversations.setProperties API method:

PropertySet byDescription
agent_session_viewssetViewUnified view list spanning all view types (max 5). Each entry contains view_id, type, file_id, view_key, name, date_added, content_version.

agent_session_views​

The agent_session_views array is the canonical list of views attached to the channel. It contains all view types (html, diff, block_kit, canvas) in a single array. Each entry contains enough information for clients to render a view tab dropdown and determine which API to call for rendering:

PropertyTypeDescription
view_idstringEncoded channel tab ID.
typestringView type: html, diff, block_kit, or canvas.
file_idstringEncoded ID of the backing file.
view_keystringAgent-assigned stable key. Absent for diff views.
namestringDisplay label for the view tab.
date_addedintegerUnix timestamp of when the view was created.
content_versionintegerServer-assigned content version.

Context bar items​

The context bar runs along the top of a code channel and holds up to 5 agent-supplied items; for example, quick orientation and quick actions for the people in the channel: repo, branch, PR, CI status, or anything else that helps users follow the session. Set them via the agents.conversations.setProperties API method as code_channel.context_bar_items. The array you send replaces the current set.

Schema​

PropertyTypeRequiredDescription
keystringRequiredUnique identifier for the item within the channel. Maximum 64 characters.
labelstringRequiredDisplay text. Maximum 128 characters.
iconstringOptionalIcon shown beside the label. Can be branch, folder, hierarchy, life-ring, link, globe, terminal, code, search, or lock.
urlstringOptionalMakes the item a link to this URL. Maximum 2048 characters.
item_typestringOptionalinfo (default, informational) or action (interactive; clicking delivers a code_channel_action event to your app).

A bot_user_id property also appears on items when reading them back; it is populated by the server to attribute the item to your agent and should not be set by your app.

Example​

{
"channel_id": "C9876543210",
"code_channel": {
"context_bar_items": [
{
"key": "repo",
"label": "borant/billing",
"icon": "folder",
"url": "https://github.com/borant/billing"
},
{
"key": "branch",
"label": "agent/migrate-cron",
"icon": "branch",
"url": "https://github.com/borant/billing/tree/agent/migrate-cron"
},
{
"key": "pr",
"label": "PR #42 is open",
"icon": "hierarchy",
"url": "https://github.com/borant/billing/pull/42"
},
{
"key": "ci",
"label": "Tests passing",
"icon": "terminal",
"url": "https://github.com/borant/billing/actions/runs/12345"
},
{
"key": "create-pr",
"label": "Create PR",
"icon": "hierarchy",
"item_type": "action"
}
]
}
}

agent_resource​

For sessions centered on an external resource, setProperties accepts an agent_resource object instead of, or alongside, code_channel:

PropertyTypeDescription
urlstringURL of the external resource. Maximum 2048 characters.
resource_typestringType of the external resource. Maximum 64 characters.
titlestringDisplay title of the external resource. Maximum 255 characters.
providerstringProvider of the external resource. Maximum 64 characters.

record_channel​

Code channels are also marked with a record_channel property block with record_type: "agent_channel".

Recognizing a code channel​

record_channel.record_type === "agent_channel" is the check to use. It is set when the channel is created, is never absent from a code channel, and never appears on any other kind of channel, so it is correct for every code channel regardless of when it was created or how far along its session is:

{
"properties": {
"record_channel": {
"record_id": "AC:9819220113844:11770567636866:C0BR6NP78F5",
"record_type": "agent_channel"
}
}
}

The agent_session and code_channel properties are also present on every newly created code channel, so either can serve as a proxy. Prefer record_channel anyway: code_channel in particular is about the channel's code metadata, so an empty {} means "no metadata yet", not "not a code channel", and code channels created before that key was seeded at creation may not carry it at all until your agent writes to it.