← Google Calendar + PagerDuty integrations

Find Oncall User with PagerDuty API on Event Start from Google Calendar API

Pipedream makes it easy to connect APIs for PagerDuty, Google Calendar and 800+ other apps remarkably fast.

Trigger workflow on
Event Start from the Google Calendar API
Next, do this
Find Oncall User with the PagerDuty API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜
Trusted by 250,000+ developers from startups to Fortune 500 companies:
Trusted by 250,000+ developers from startups to Fortune 500 companies

Developers Pipedream

Getting Started

This integration creates a workflow with a Google Calendar trigger and PagerDuty action. When you configure and deploy the workflow, it will run on Pipedream's servers 24x7 for free.

  1. Select this integration
  2. Configure the Event Start trigger
    1. Connect your Google Calendar account
    2. Select a Calendar ID
    3. Configure timer
  3. Configure the Find Oncall User action
    1. Connect your PagerDuty account
    2. Select a On-Call Schedule ID
    3. Select a User ID
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, open source components from Pipedream's GitHub repo. These components are developed by Pipedream and the community, and verified and maintained by Pipedream.

To contribute an update to an existing component or create a new component, create a PR on GitHub. If you're new to Pipedream component development, you can start with quickstarts for trigger span and action development, and then review the component API reference.

Trigger

Description:Emits a specified time before an event starts
Version:0.1.1
Key:google_calendar-event-start

Trigger Code

import common from "../common.mjs";

export default {
  ...common,
  key: "google_calendar-event-start",
  name: "Event Start",
  description: "Emits a specified time before an event starts",
  version: "0.1.1",
  type: "source",
  dedupe: "unique", // Dedupe events based on the Google Calendar event ID
  methods: {
    ...common.methods,
    getConfig({
      intervalMs, now,
    }) {
      const timeMin = now.toISOString();
      const timeMax = new Date(now.getTime() + intervalMs).toISOString();
      return {
        calendarId: this.calendarId,
        timeMax,
        timeMin,
        singleEvents: true,
        orderBy: "startTime",
      };
    },
    isRelevant(event, {
      intervalMs, now,
    }) {
      const eventStart = event?.start?.dateTime;
      const start = new Date(eventStart);
      const msFromStart = start.getTime() - now.getTime();
      return eventStart && msFromStart > 0 && msFromStart < intervalMs;
    },
  },
};

Trigger Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI and CLI.
LabelPropTypeDescription
Google CalendargoogleCalendarappThis component uses the Google Calendar app.
Calendar IDcalendarIdstringSelect a value from the drop down menu.
timer$.interface.timer

Trigger Authentication

Google Calendar uses OAuth authentication. When you connect your Google Calendar account, Pipedream will open a popup window where you can sign into Google Calendar and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any Google Calendar API.

Pipedream requests the following authorization scopes when you connect your account:

emailprofilehttps://www.googleapis.com/auth/calendar.eventshttps://www.googleapis.com/auth/calendar.readonlyhttps://www.googleapis.com/auth/calendar.settings.readonly

About Google Calendar

Scheduling calendar service developed by Google

Action

Description:Find the user on call for a specific schedule. [See the docs here](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODE5MA-list-users-on-call)
Version:0.0.1
Key:pagerduty-find-oncall-user

Action Code

import pagerduty from "../../pagerduty.app.mjs";

export default {
  key: "pagerduty-find-oncall-user",
  name: "Find Oncall User",
  description: "Find the user on call for a specific schedule. [See the docs here](https://developer.pagerduty.com/api-reference/b3A6Mjc0ODE5MA-list-users-on-call)",
  type: "action",
  version: "0.0.1",
  props: {
    pagerduty,
    scheduleId: {
      propDefinition: [
        pagerduty,
        "oncallScheduleId",
      ],
    },
    userId: {
      propDefinition: [
        pagerduty,
        "userId",
      ],
    },
  },
  async run({ $ }) {
    const {
      scheduleId,
      userId,
    } = this;

    const { users } =
      await this.pagerduty.listUsersOncall({
        $,
        scheduleId,
      });

    const userFound = users.find(({ id }) => id === userId);

    const summary = userFound
      ? `${userFound.name} is On-Call for selected schedule`
      : "No user found for selected schedule";

    $.export("$summary", summary);

    return userFound;
  },
};

Action Configuration

This component may be configured based on the props defined in the component code. Pipedream automatically prompts for input values in the UI.

LabelPropTypeDescription
PagerDutypagerdutyappThis component uses the PagerDuty app.
On-Call Schedule IDscheduleIdstringSelect a value from the drop down menu.
User IDuserIdstringSelect a value from the drop down menu.

Action Authentication

PagerDuty uses OAuth authentication. When you connect your PagerDuty account, Pipedream will open a popup window where you can sign into PagerDuty and grant Pipedream permission to connect to your account. Pipedream securely stores and automatically refreshes the OAuth tokens so you can easily authenticate any PagerDuty API.

Pipedream requests the following authorization scopes when you connect your account:

About PagerDuty

Real-Time Operations and Incident Response

More Ways to Connect PagerDuty + Google Calendar