Loading
Loading
  • Home

  • Automation with Zapier

  • Zapier tutorials

Zapier tutorials

6 min read

How to create an on-call notification bot with Zapier

By Krystina Martinez · May 16, 2022
A bell icon

As an IT professional, you're tasked with safeguarding your business from any tech disasters, whether it's security issues, errors, or troubleshooting for your coworkers. That usually means your team has an on-call schedule, so there's always someone available to help. 

Those on-call shifts can sneak up on you though, especially if you're in the midst of projects. Zapier can help you keep your team—and your company—up-to-date on your on-call shifts without breaking your focus.   

We'll show you how you can create a Zap—what we call our automated workflows—that announces the upcoming on-call schedule in your team chat app. 

You'll need a Zapier account to use the workflows in this piece. If you don't have an account yet, it's free to get started.

Skip ahead:

How to create an on-call notification bot with PagerDuty

For this tutorial, we'll show you how to create an on-call notification bot with PagerDuty. If you don't use PagerDuty or another incident response platform to manage your on-call schedule, you can use your calendar instead

Before you begin

Make sure you have an on-call schedule created in PagerDuty with users assigned. You'll also need to make sure you've created an API access key within your PagerDuty account. You'll need this key to connect PagerDuty with Zapier. 

To create your access key, log in to your PagerDuty account. Once you've signed in, click on Integrations in the top menu and select API Access Keys. 

A red box highlights the "API Access Keys" menu item in PagerDuty.

You'll see a list of any existing API keys. Click on + Create New API Key.

A red arrow points to the "Create A New API Key" button in PagerDuty.

Give your API Key a name and click Create Key. 

A window in PagerDuty prompts the user to add a description for the API key.

PagerDuty will generate an API key for you. This is the only time PagerDuty will show you your access key, so I recommend saving it to a password manager to reference later. 

A window revealing the new API key that was just created in PagerDuty.

We'll refer back to this key later in this tutorial. 

Create your Schedule trigger

When you're ready to create your Zap, sign in to your Zapier account and click Create Zap to navigate to the Zap editor

You'll be prompted to create your trigger—the event that starts your Zap. Since we want our Zap to run on a recurring schedule, we'll select Schedule as our trigger.

The trigger step in the Zap editor. A box highlights Schedule by Zapier.

Next, you'll need to select your event—how often you want Schedule to run. For our example, we'll select Every Week, but you can select whatever cadence you'd like.  

A box highlights the trigger event options for Schedule by Zapier.

Now we'll select the day of the week we want our Zap to run and the time.  

Configuring the trigger event. A dropdown menu displays the days of the week.

Zapier defaults to on-the-hour increments, but if you want something to run at, say, 10:30 a.m., you can type that in instead.

Just click on the Custom tab and type in the time you want your Zap to run.  Zapier can handle both 12- and 24-hour formats. Just make sure to specify whether it's a.m. or p.m. if you're using the 12-hour format. Click Continue when you're done.

A box highlights the Time of Day field and the Custom tab.

Next, click on Test Trigger. 

 Zapier will look for a day of the week (or month or year). It will default to the time you tested your Zap, but don't worry if it doesn't match your specifications. Once you publish your Zap, it will run on the schedule you configured. 

Testing the Schedule trigger in the Zap editor. The sample data is the current date, day, and time.

Click Continue. 

Add your PagerDuty search step

Next, it's time to add an action, which is the event your Zap will perform once it's triggered. Our action for this Zap will be a search step. 

Select PagerDuty and then select Find User on Call as your Event. Click Continue.

Selecting the action in the Zap editor. PagerDuty is the action app and Find User on Call is the action event.

Certain apps with Zapier integrations support search steps. Check the App Directory to see if your app has a search action available. Pay attention to words like Find, Search, or Lookup in the action description. 

Next, select your PagerDuty account. If you haven't connected PagerDuty to Zapier before, click + Connect a new account

Selecting the PagerDuty account to connect to Zapier. A dropdown menu shows already-connected PagerDuty accounts.

For each app you connect, Zapier will ask for a general set of permissions which allows you to be flexible with your Zaps. The only actions Zapier takes on your app accounts are those a given Zap needs to accomplish what you've set up.

Type in your account name and the API key you saved earlier, and click Yes, Continue. 

A Zapier permissions window to access PagerDuty. Empty fields require the PagerDuty account name and API key.

Once your account is connected, click Continue. 

Next, we'll set up our PagerDuty search. Click on the dropdown beneath the Schedule field and select the existing on-call schedule you want to search within. 

A dropdown menu to select the PagerDuty on-call schedule to search.

Under Start Time, you'll set up the start time for the events you want to search. For example, if you want to search for an on-call shift that starts the day after your Zap runs, you'd type in +1 day.  That way, you're telling your team who is on the schedule for the next day.

Configuring the start time to search for within a PagerDuty schedule. "+1 day" is typed in.

You'll set up your End Time similarly as well. 

Configuring the end time to limit the search to within a PagerDuty schedule. "+2 days" is typed in.

Next, we'll configure what we want Zapier to do if our PagerDuty search fails. 

Under Should this step be considered a "success" when nothing is found, this is set to Yes by default.  You'd use this if you wanted to create branching logic using Paths. For example, if you wanted your Zap to take specific actions depending on whether Zapier finds a user on call in PagerDuty, you could use Paths.

For the purpose of this tutorial, we're going to select No. 

Configuring what to do with failed searches within the Zap editor. A dropdown menu has "Yes" and "No" options.

Click Continue. 

Now it's time to test our search step. I recommend testing this because we'll use the results of this search to set up the rest of our Zap. Click Test & review. 

Testing the PagerDuty search action in the Zap editor.

Pay close attention to your search results. You'll see a field called _zap_search_was_found_status. If your search was successful, the status will be true. If you see false instead and weren't expecting that, go back to the previous step, adjust your search parameters, and retest. Once you're satisfied, click Continue. 

A successful test of the PagerDuty search step. A box highlights a field that tells the user whether the search was successful.

Note: If you want your notification to include the person who is on-call this weekend and next weekend, you can add a second search action. Just repeat these steps and adjust your search criteria appropriately. 

Add your notification action

Now we'll create our notification step. For this example, we're using Slack, but you can use any chat app with a Zapier integration. 

Select Slack as your action app and Send Channel Message as the action event and click Continue. 

Selecting the action in the Zap editor. Slack is the action app and Send Channel Message is the action event.

Next, select your Slack account from the dropdown menu, or connect your workspace if you haven't connected Slack to Zapier before. Once you're done, click Continue.

The account selector in the Zap editor. A Slack account is already connected.

Then, select the channel you want to send your message to. 

Under Message Text, you can customize how you want your notification to look. You can use a combination of text—which will appear the same each time your Zap runs—and dynamic values from previous steps in your Zap.

Click inside the Message Text field. You'll see a dropdown menu of the previous steps in your Zap so far. Click on the upside-down caret next to each step. This will reveal the data that Zapier found when we tested our trigger and search steps. 

Field mapping within the Zap editor. An arrow points to a dropdown menu with the previous steps of the Zap.

Then, select the information from your Schedule trigger and PagerDuty search that you'd like to use within your message. 

Field mapping within the Zap editor. A dropdown menu shows data from the Schedule trigger.

Here's what it looks like when you combine static text and data from our previous Zap steps: 

Configuring the Slack message in the Zap editor. Text is typed in, along with dynamic values selected from Schedule.

For this example, we want to include the date that the Zap triggered, the user in PagerDuty who's on call, and the email to contact them.  You can format your message however you'd like, just make sure it's compatible with your team chat app. 

A customized Slack message that contains static text and dynamic values from PagerDuty and Schedule by Zapier.

A dynamic value is any data from a previous Zap step that you've mapped to a field in the Zap editor. When you map a dynamic value—such as a contact name—what you see in the editor is a placeholder. Field mapping dynamic values are how you pass data from one app to another. Once your Zap is turned on, Zapier will send the information that the field contains every time your Zap runs.

Next, we'll configure the rest of our message. By default, Zapier will send this message as a bot. That's what we want, so we'll continue setting up the Bot Name and Bot Icon

Under Include a link to this Zap?, make sure Yes is selected. This makes it easy for you—or anyone else on your team—to make changes to your Zap quickly.   

Slack settings to configure in the Zap editor.

When you're done customizing your message, click Continue. 

Finally, it's time to test our Zap. This will send a message in the selected Slack channel. You'll want to test this to make sure your message is formatted correctly. 

We recommend having a dedicated team channel for testing Zaps. If you don't have one, just warn your coworkers that you're testing something. Click Test & Review.

Testing the Slack action in the Zap editor. The pane displays the information Zapier will send to Slack.

You'll see a success message, but let's check Slack to see how everything looks.

The on-call notification message in Slack.

If something looks strange with the formatting, you can go back to the previous step, make adjustments, and retest your Zap. Once you're satisfied, you're ready to begin using your Zap. 

Create an on-call notification bot from your calendar

Using Zapier with PagerDuty is just one way to create an on-call notification bot. To keep things simple, you can also manage your on-call schedule from the calendar app you're already using. 

A Google Calendar displaying events through the weekend.

Google Calendar makes it easy to create multiple calendars for all sorts of things. First, create a new calendar and populate it with upcoming shifts. Then, try our tutorial for sending Google Calendar reminders to Slack. The concept will also apply if you use Microsoft Outlook and Microsoft Teams.

Stay on top of on-call shifts with automation

Don't let those on-call shifts sneak up on you. Automation with Zapier can help you communicate upcoming on-call shifts to your team and company. That way, everyone can breathe easy knowing IT has their back.  

New to Zapier? It's workflow automation software that lets you focus on what matters. Combine user interfaces, data tables, and logic with 6,000+ apps to build and automate anything you can imagine. Sign up for free.

Get productivity tips delivered straight to your inbox

We’ll email you 1-3 times per week—and never share your information.

tags

Related articles

Improve your productivity automatically. Use Zapier to get your apps working together.

Sign up
A Zap with the trigger 'When I get a new lead from Facebook,' and the action 'Notify my team in Slack'