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
diffview with aview_keygets its own tab, labeled withname, so a channel can show more than one diff. Adiffwith noview_keystill fills the built-in Code tab. - Slack List views. Pass
type: "list"and alist_idto 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_idinstead ofcontent. Your app owns that file, so delete it yourself after you remove the view.
Breaking changes
- The
code_channel.pr_statusproperty accepts onlyopen,draft,merged,closed,blocked, or"". An empty string now clears the status instead of meaning a draft, so senddraftfor draft pull requests. Any other value, including a different case such asOpen, returnsinvalid_pr_status, and nothing in that call is saved. - The
code_channelobject no longer acceptspr_url,pr_number,pr_title,ci_url, orci_state, and a call that includes any of them returnsinvalid_arguments. Add a PR tab instead. - The
setViewmethod used to ignoreview_keyandnamefortype: "diff". A diff call with aview_keynow creates a keyed diff, and the Code tab stops updating. To keep updating the Code tab, remove theview_key. - When more than one view has the
view_keyyou pass, theagents.conversations.removeViewAPI method returnsambiguous_view_keyand removes nothing. Passview_idinstead, or use distinct keys across view types.
Read on to learn more: