Keep track of GitHub issues using a Postman collection

At Postman, we have a support page on GitHub for the Postman community to submit bugs and request new features. Our team works hard to fix bugs and ship features quickly, but sometimes, even we can lose track of these issues.

The goal at Postman is for every new issue to be assigned to Postman staff, properly labeled, with an initial reply within 24 hours. We don’t want to miss out any new issues, and want to address every one in a timely manner.

As a Postman engineer, I decided to use a Postman collection and monitor to solve this issue. A collection is just a bunch of requests and a monitor can be set up to run a collection at periodic intervals on Postman servers.
I used the GitHub API to get the issues submitted on GitHub and a Slack webhook to send a report to our team Slack channel.

Let’s break it down.

The first request in the collection establishes some important environment variables, and then only proceeds to the next requests if the current day is a weekday. The next request gets a list of members who are part of the Postman organization from the GitHub API. This is done so that we know whether anyone from our team has already replied to a new issue.

Then for each issue, a GET request is made to retrieve the comments. For this, we define a single request which uses an environment variable for the issue number. It calls itself recursively using the pm.setNextRequest() method until there are no more issues left. There was a very nice blog about using this method for conditional workflows.

Now just looping over the list of issues and comments we can know which issues were missed. We set this data to an environment variable which is used by the next request to send a slack message.

Now that we have a collection which sends a report as a Slack message, we want it to run automatically at the end of each day. For this, we can use a Postman Monitor and set it to run this collection at 6 pm daily.

After setting this up, we see a report like this in our internal channel:

Or hopefully a report like this:

Try it yourself

Click the Run in Postman button to import the GitHub Support sample collection and environment template into your Postman app. Update the required environment variables with your own personal credentials, such as your GitHub API token and your Slack webhook URL.

Once you have the collection running locally, you should receive a slack message with a summary of Postman issues that were missed by Postman staff. This is all very helpful if you want to keep watching the Postman repo, but it’s likely that now you want to swap out the Postman info with your own. Update the pre-request script for the first request so that you’re watching your own repos managed by your own organization.

The last step is to set up a monitor to run the collection on a daily frequency to receive your alerts.

Never miss an issue again!


Need help getting started? Read the GitHub Support collection documentation for step-by-step instructions and helpful references.

What do you think about this topic? Tell us in a comment below.

Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.