Use Slack command to update a page on Confluence

Tae Hoshino
3 min readJul 6, 2021

In many workplaces nowadays, Slack is a central communication channel. However, one of our challenges is “How to keep track of great ideas and prevent them from getting lost in conversations”.

A potential solution to this would be integrating Slack with Confluence.

This article walks through the steps to create a Slack slash command that invokes Postman Collection to update a page on Confluence.

Step-by-Step

  1. Create a new page on Confluence. The point here is to use some kind of separator. This is to separate the part of the page where bot will update from the rest of the page. In this example, I am using “←DO NOT REMOVE THIS LINE →” as a separator.

2. Fork this collection and this environment to your own workspace

3. Use Postman API endpoint to create webhook for this collection.

If this is your first time using Postman API, you will first need to fork the entire “Postman API” collection. Next, go to https://go.postman.co/settings/me/api-keys to generate your API key and enter your key in the current value field of the collection variable postman_api_key.

For workspace_id, select workspace id which you can retrieve from URL when opening the workspace on web dashboard. Your workspace URL has this format https://YOUR_TEAM_DOMAIN.postman.co/workspace/YOUR_WORKSPACE_NAME~WORKSPACE_ID/overview

As the body of the request, make sure to specify “environment” as well, i.e.

{
"webhook":{
"name": "{{webhook_name}}",
"collection": "{{collection_uid}}",
"environment": "{{environment_uid}}"
}
}

You can retrieve collection_uid and environment_uid from the desktop app:

Hit “Send” and successful response will contain webhook URL.

For more information about webhook, see Learning Center or YouTube

4. Go to your Slack app page: https://api.slack.com/apps and create a new app.

5. From “Basic Information” > “Add features and functionality”, select “Slash Commands”. Enter the webhook URL obtained above in “Request URL” field.

6. Finally, install app to your workspace and you can use the slash command!

Try it out!

Typing /mySlashCommand some text would trigger the slack bot and invokes the Postman Collection via Webhook.

TA-DA!

--

--