Skip to main content

PR tabs and new view types in code channels

Your agent can now show the GitHub pull requests it opens as tabs in a code channel, give each diff its own tab, and pin Slack Lists. A few of these changes affect existing calls, so read the breaking changes before you update your app.

PR tabs​

A PR tab shows a pull request on github.com, read live from GitHub with each viewer's own GitHub account. People in the channel can follow its state, checks, and reviews without leaving Slack, and your app never sends them. Call the agents.conversations.setView API method with type: "pull_request", a view_key, and the pull request's pr_url:

POST /api/agents.conversations.setView
{
"channel_id": "C9876543210",
"type": "pull_request",
"view_key": "borant/billing#42",
"pr_url": "https://github.com/borant/billing/pull/42"
}

PR tabs load only for repositories where the Slack Code GitHub App is installed and the installation is approved in Slack. Until then, setView saves the view and returns the github_not_connected warning. Refer to the requirements.

A channel can hold up to 10 PR tabs, and they don't count against the channel's other view or tab limits. Set the channel's overall PR status with code_channel.pr_status in the agents.conversations.setProperties API method, which now also accepts draft.

More view types​

  • Keyed diffs. A diff view with a view_key gets its own tab, labeled with name, so a channel can show more than one diff. A diff with no view_key still fills the built-in Code tab.
  • Slack List views. Pass type: "list" and a list_id to pin a list your agent created, or one already shared in the channel, as a tab.
  • HTML views from a file. Upload the HTML document with your bot and pass its file_id instead of content. Your app owns that file, so delete it yourself after you remove the view.

Breaking changes​

  • The code_channel.pr_status property accepts only open, draft, merged, closed, blocked, or "". An empty string now clears the status instead of meaning a draft, so send draft for draft pull requests. Any other value, including a different case such as Open, returns invalid_pr_status, and nothing in that call is saved.
  • The code_channel object no longer accepts pr_url, pr_number, pr_title, ci_url, or ci_state, and a call that includes any of them returns invalid_arguments. Add a PR tab instead.
  • The setView method used to ignore view_key and name for type: "diff". A diff call with a view_key now creates a keyed diff, and the Code tab stops updating. To keep updating the Code tab, remove the view_key.
  • When more than one view has the view_key you pass, the agents.conversations.removeView API method returns ambiguous_view_key and removes nothing. Pass view_id instead, or use distinct keys across view types.

Read on to learn more: