message.session event
A message was posted to a code channel
Facts
Usage info
Subscribe to the message.session event to receive messages posted in code channels. This subscription doesn't deliver messages from any other channels.
Your app's bot user must be a member of a code channel to receive its messages. Slack invites your bot user to each code channel your app creates with the agents.conversations.create API method.
This example includes both the event wrapper and the event structure for the message.session event.
{
"token": "one-long-verification-token",
"team_id": "T123ABC456",
"api_app_id": "A123ABC456",
"event": {
"type": "message",
"channel": "C123ABC456",
"user": "U123ABC456",
"text": "Can you also add a test for the retry path?",
"ts": "1355517523.000005",
"event_ts": "1355517523.000005",
"channel_type": "channel"
},
"type": "event_callback",
"authorizations": [
{
"team_id": "T123ABC456",
"user_id": "U234BCD567",
"is_bot": true,
"is_enterprise_install": false
}
],
"event_id": "Ev123ABC456",
"event_time": 1355517523
}
The payload is identical to a message.channels or message.groups event, and no field marks the message as coming from a session. The channel_type field is set to "channel" for a public code channel and "group" for a private code channel. Messages often include many more fields than those shown above, and message subtypes such as message_changed arrive the same way.
Combining with other message events
If your app already subscribes to message.channels or message.groups, those subscriptions also deliver messages from code channels. Your app can subscribe to both message.session and the broader channel events without receiving duplicates, because Slack delivers each message to your app at most once.
The message.session event doesn't deliver messages from direct messages or multi-person direct messages. To receive only messages that mention your app, subscribe to app_mention events instead. Refer to scopes for Slack Code for how code channels use message events.