github — Photo by Roman Synkevych on Unsplash

Personalized Github Reminder for Slack (and Discord 😜)

Why a Pull Request Reminder?

As a tech team, we love when new features and bug fixes are shipped fast in production. For this, we want, as a member of this dev team, to be reminded of all Pull Requests I have missed (sorry guys…) and the ones which are finished but not merged yet.

It’s also a nice time to grab a coffee and make some code review.

We want to maintain this fast track for many reasons:

  • The more you wait, the more you will be creating conflicts and differences with the work in progress inside other teams
  • For bug fixes: they are ready, so why wait much more time to ship it to end-users? Some fixes can be the difference between a bad and a good day
  • All devs can rely on your new code, including new functions, utilities, and components

There is already a scheduled reminder feature inside GitHub, but we wanted to have more control over notifications and have rules based on code.

Also, this feature on Github is only available for Slack and we wanted to make it compatible with Discord too.

How we have done it with Meta API

We have done it with a Spell, of course!

If you are not familiar with the concept of Spell: a Spell is an API integration done in our platform, Meta API, which combines both TypeScript (and JavaScript) code with Connectors, a special way to manipulate APIs. We believe that APIs should be as simple as manipulating functions inside a piece of code: that’s why we automate the security, configuration, and monitoring of any APIs but without losing control or freedom on what we connect.

Then, this Spell will be deployed as an API and can be run manually, with a scheduler, or even with an external Webhook.

Our Pull Reminder Spell inside Meta-API

This is how this Spell works:

  • As an API, we will provide as a parameter a list of repositories we want to scan
  • For each repo, we will:
  • Retrieve all the Pull Requests
  • Filter them (we don’t want to be notified of pull requests generated by dependabot for example)
  • Get some details for each PR, like the creation date, the number of commits, if our automated tests run successfully, etc.
  • Check if each reviewer has done his review and get the associated status
  • Mix all these data and create a nice Slack message
  • Send, we send the message on Slack on our custom channel

We have created a bunch of functions to retrieve and transform data from GitHub like a list of Pull Request, reviews attached to these pull requests, etc…

Here is how our final Slack API message looks like

The final reminder render on Slack
The final reminder render on Slack

Step by step

The code you write inside your own Spell on Meta-API is plain TS / JS code: so it can be reused outside Meta API. Each part managed by connectors can be replaced by libraries or API requests done by a client like axios.

Of course, you will lose the automatic monitoring, the ability to update your Spell with new connectors in minutes, etc. but it will continue to work!

So here is our step-by-step creation with technical details.

The main processing

Our main processing code is simple and consist in imbricated loops.

For starting, we want to create a counter and an array to store the text section we will send later to Slack

Then, we start our loop over each repositories

We call an internal function to help us getting all info about a repo: getPullRequests(repo)

Then we apply a filter on it to remove drafts and dependabot PRs.

We increment our counter and generate an header block for Slack based on the number of PRs.

We now need to go deeper inside each PR and retrieve more information

First, we will also use internal functions to details and all the reviewers on each PR.

Tips: we use Promises and concurrent calls to make our code a bit faster!

Then, we prepare a bunch of text to create a nice display on Slack. You can use the Block Kit Builder on Slack to help you with this particular format.

Let’s then loop over reviewers to determine if there have already done the review or not and choose a nice emoji to represent it.

In the end, we push new blocks inside our Slack array to build our message line by line.

Here is the full code:

Functions to make our code cleaner

Here are a bunch of functions we used to make our main code much more readable:


This function will call our Connector with all the configurations inside our Connector interface, like binding the correct repo and owner, sorting repos, filtering by a specific state, etc…

All APIs capabilities are extracted and available through our interface.

The whole interface is dynamically generated from an Open API Specification file, making our platform compatible with any APIs.


We first extract some data into variables to binding them into the connector interface


Same thing for extracting info into variables to binding them

getEmojiState and addReviewer

More utility functions to help us with formatting and manipulating arrays.

You can see TypeScript’s type between this function to enforce some type checking.

The final part is formatting the blocks for Slack and send through Slack’s Connector


That’s it! Our Spell is ready to be used with a total of 4 connectors and 163 lines of code (with a lot of spaces).

It will be versioned, deployed, and monitored in less than 30s. If anything is going wrong after going live, we will receive notifications.

You can find it here with the source code:

Use it and let us know what you think about it!!

What about Discord?

As you can read, the text is formatted for Slack and then sent through a dedicated connector. We are migrating our internal communication from Slack to Discord and we already updated some of our Spell to use Discord.

Here is an example of how we can send a message both on Slack and Discord within the same Spell:

Meta API Spell
A Spell used to notify the team when we ship a new release on production

So we will need to change the way we format messages on Discord, testing it on our staging environment, and then push it to production.

Next improvements

We think about many features we can add to our Spell:

  • Mention people to get more attention
  • Trigger some alerts if a PR is not merged within 4 days
  • Create a summary of all comments inside each PRs

Send us your ideas in comments!




Meta API is where integration becomes an extension of your team, enabling you to consistently deliver innovation with speed and agility.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

¿How to monitor Salesforce Limits Proactively?

Variables In Code

youtube tv

Connecting Spring Boot with React.js with Class Components

How to build a Foreignrap clone using Nuxt, Airtable and a bit of hardcore 🔥

Laravel 5.3 to 5.8 with Vue JS (Part2)

How to describe a property as both optional and nullable in RAML.

Install And Run The Vue JS 3 Project Using Vue CLI [2021]

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Meta API

Meta API

Meta API is where integration becomes an extension of your team, enabling you to consistently deliver innovation with speed and agility.

More from Medium

My dev notifications workflow

Technical debt in eCommerce — a silent killer of the revenue — BitBag

How to fix NVM slowing down terminal startup on Mac

Allowing admin users to decide who should and shouldn’t receive daily push notifications