Lets you run a Postman monitor after a CircleCI build completes successfully.

This application hooks into your CircleCI configuration and will run a Postman monitor after a successful build. A Slack user will have the option to re-run a monitor in case there was a blip.

Before you begin#

You need to have:

  • a Transposit account
  • a Slack account (in a workspace where you can install apps)
  • a Postman account that is monitoring at least one URL (more here)
  • a repository with CircleCI configured to build it and with an Orb to post notifications on CircleCI runs (more here)

Here's a sample CircleCI config.yml to add to your repo:

version: 2.1
description: Send webhook to trigger postman check
- run:
name: On success
when: on_success
command: |
curl <webhook_circleci URL> -d '{"payload":{"reponame":"'"$CIRCLE_PROJECT_REPONAME"'","branch":"'"$CIRCLE_BRANCH"'","build_parameters":{"CIRCLE_JOB":"'"$CIRCLE_JOB"'"},"outcome":"fixed","build_url":"'"$CIRCLE_BUILD_URL"'"}}' -H "Content-Type: application/json" -X POST --fail

- image: circleci/node:lts
- checkout
- run: exit 0
- slack/notify:
color: '#42e2f4'
message: Your build has finished.
webhook: <slack webhook> # from the CircleCI instructions on setting up an orb
- notify_job_status
slack: circleci/slack@3.3.0
- build

Set things up#

Fork the application.

Go to Deploy > Endpoints and copy the webhook URL for both webhook_circleci and webhook_slack_button.

Create a Slack application (call it PostmanBot). You'll want to make sure that you set up a bot user and enable interactive components.

Configuration summary of the Slack application:

  • In Interactive Components > Interactivity, add the URL you noted for webhook_slack_button as the 'Request URL'.
  • In OAuth & Permissions > Scopes, set it to chat:write:bot bot.
  • In OAuth & Permissions > Redirect URLs, use https://accounts.transposit.com/oauth/v2/handle-redirect
  • In Bot Users, add a bot user with the name PostmanBot.
  • In Basic Information, install your application into your workspace.

Go to your Transposit application and provide your credentials for both Postman and Slack. You'll have to do this both Code > Development > Auth & Settings and in Deploy > Production Keys. Make sure you authorize following these steps because you want the application to act as PostmanBot, not as you.

Update your CircleCI configuration to post to the webhook_circleci URL when CircleCI completes successfully.

Configure your environment variables under Deploy > Environment Variables. You are setting up both the Slack channel the bot should post to and the monitor id for the Postman monitor.

Make sure you invite the bot to the Slack channel that you specified in the environment variables: /invite @PostmanBot.

Final product#

Push a commit to your sample repository. You should see the CircleCI Orb post first, and then PostmanBot.

Re-run the Postman monitors by clicking 'Re-run Postman' and see the new results in a thread.