← Google Calendar + SWAPI - Star Wars integrations

Get Film with SWAPI - Star Wars API on Upcoming Event Alert from Google Calendar API

Pipedream makes it easy to connect APIs for SWAPI - Star Wars, Google Calendar and 1000+ other apps remarkably fast.

Trigger workflow on
Upcoming Event Alert from the Google Calendar API
Next, do this
Get Film with the SWAPI - Star Wars API
No credit card required
Into to Pipedream
Watch us build a workflow
Watch us build a workflow
7 min
Watch now ➜

Trusted by 500,000+ developers from startups to Fortune 500 companies

Adyen logo
Brex logo
Carta logo
Checkr logo
Chameleon logo
DevRev logo
LinkedIn logo
Netflix logo
New Relic logo
OnDeck logo
Replicated logo
Scale AI logo
Teamwork logo
Warner Bros. logo
Xendit logo

Developers Pipedream

Getting Started

This integration creates a workflow with a Google Calendar trigger and SWAPI - Star Wars 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 Upcoming Event Alert trigger
    1. Connect your Google Calendar account
    2. Connect your Google Calendar account
    3. Select a Calendar ID
    4. Select a Event Name
    5. Configure Minutes Before
  3. Configure the Get Film action
    1. Connect your SWAPI - Star Wars account
    2. Select a film
  4. Deploy the workflow
  5. Send a test event to validate your setup
  6. Turn on the trigger

Details

This integration uses pre-built, source-available 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:Triggers based on a time interval before an upcoming event in the calendar. This source uses Pipedream's Task Scheduler. [See here](https://pipedream.com/docs/examples/waiting-to-execute-next-step-of-workflow/#step-1-create-a-task-scheduler-event-source) for more information and instructions for connecting your Pipedream account.
Version:0.0.1
Key:google_calendar-upcoming-event-alert

Google Calendar Overview

The Google Calendar API gives developers access to Google Calendar data,
allowing them to create their own applications that can read, write, and update
calendar data. With the API, users can integrate their own calendar
applications with Google Calendar, giving them the ability to manage their
calendars in one place. The API also provides the ability to search for events
and create new events.

Possible applications that could be built using the Google Calendar API
include:

  • A calendar application that integrates with Google Calendar, allowing users
    to manage their calendars in one place.
  • A calendar application that allows users to search for events and create new
    events.
  • A to-do list application that integrates with Google Calendar, allowing users
    to see their tasks and events in one place.
  • A reminder application that uses Google Calendar data to remind users of
    upcoming events.

Trigger Code

import taskScheduler from "../../../pipedream/sources/new-scheduled-tasks/new-scheduled-tasks.mjs";
import googleCalendar from "../../google_calendar.app.mjs";
import { axios } from "@pipedream/platform";

const docLink = "https://pipedream.com/docs/examples/waiting-to-execute-next-step-of-workflow/#step-1-create-a-task-scheduler-event-source";

export default {
  key: "google_calendar-upcoming-event-alert",
  name: "Upcoming Event Alert",
  description: `Triggers based on a time interval before an upcoming event in the calendar. This source uses Pipedream's Task Scheduler.
    [See here](${docLink}) for more information and instructions for connecting your Pipedream account.`,
  version: "0.0.1",
  type: "source",
  props: {
    pipedream: taskScheduler.props.pipedream,
    googleCalendar,
    db: "$.service.db",
    http: "$.interface.http",
    calendarId: {
      propDefinition: [
        googleCalendar,
        "calendarId",
      ],
    },
    eventId: {
      propDefinition: [
        googleCalendar,
        "eventId",
        (c) => ({
          calendarId: c.calendarId,
        }),
      ],
    },
    time: {
      type: "integer",
      label: "Minutes Before",
      description: "Number of minutes to trigger before the start of the calendar event.",
      min: 0,
    },
  },
  hooks: {
    async activate() {
      // workaround - self call run() because selfSubscribe() can't be run on activate or deploy
      // see selfSubscribe() method in pipedream/sources/new-scheduled-tasks/new-scheduled-tasks.mjs
      await axios(this, {
        url: this.http.endpoint,
        method: "POST",
        data: {
          schedule: true,
        },
      });
    },
    async deactivate() {
      const id = this._getScheduledEventId();
      if (id && await this.deleteEvent({
        body: {
          id,
        },
      })) {
        console.log("Cancelled scheduled event");
        this._setScheduledEventId();
      }
    },
  },
  methods: {
    ...taskScheduler.methods,
    _getScheduledEventId() {
      return this.db.get("scheduledEventId");
    },
    _setScheduledEventId(id) {
      this.db.set("scheduledEventId", id);
    },
    _hasDeployed() {
      const result = this.db.get("hasDeployed");
      this.db.set("hasDeployed", true);
      return result;
    },
    subtractMinutes(date, minutes) {
      return date.getTime() - minutes * 60000;
    },
  },
  async run(event) {
    // self subscribe only on the first time
    if (!this._hasDeployed()) {
      await this.selfSubscribe();
    }

    // incoming scheduled event
    if (event.$channel === this.selfChannel()) {
      this.emitEvent(event, `Upcoming ${event.summary} event`);
      this._setScheduledEventId();
      return;
    }

    // received schedule command
    if (event.body?.schedule) {
      const calendarEvent = await this.googleCalendar.getEvent({
        calendarId: this.calendarId,
        eventId: this.eventId,
      });

      const startTime = new Date(calendarEvent.start.dateTime || calendarEvent.start.date);
      const later = new Date(this.subtractMinutes(startTime, this.time));

      const scheduledEventId = this.emitScheduleEvent(calendarEvent, later);
      this._setScheduledEventId(scheduledEventId);
    }
  },
};

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 CalendarpipedreamappThis component uses the Google Calendar app.
Google CalendargoogleCalendarappThis component uses the Google Calendar app.
N/Adb$.service.dbThis component uses $.service.db to maintain state between executions.
N/Ahttp$.interface.httpThis component uses $.interface.http to generate a unique URL when the component is first instantiated. Each request to the URL will trigger the run() method of the component.
Calendar IDcalendarIdstringSelect a value from the drop down menu.
Event NameeventIdstringSelect a value from the drop down menu.
Minutes Beforetimeinteger

Number of minutes to trigger before the start of the calendar event.

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:Get a film
Version:0.0.13
Key:swapi-get-film

SWAPI - Star Wars Overview

The SWAPI (Star Wars API) provides a wealth of data about the Star Wars
universe to build applications. With the SWAPI, developers can access detailed
Star Wars related data about people, planets, films, species and much more.
From web and mobile applications to data analysis, the possibilities are
limitless.

Here are a few examples of what developers can build using the SWAPI:

  • Create a Star Wars encyclopedia to document the Star Wars universe and its
    characters.
  • Design a custom interactive map to explore the planets of the Star Wars
    universe.
  • Analyze the data to uncover patterns and insights about Star Wars films,
    characters, and species.
  • Design a search engine to query Star Wars related data.
  • Create a mobile app that displays information about the characters, films and
    species in the Star Wars universe.
  • Design a live score system specialized in providing stats related to the Star
    Wars films and characters.

Action Code

const swapi = require("../../swapi.app.js");
const axios = require("axios");

module.exports = {
  key: "swapi-get-film",
  name: "Get Film",
  version: "0.0.13",
  description: "Get a film",
  type: "action",
  props: {
    swapi,
    film: {
      propDefinition: [
        swapi,
        "film",
      ],
    },
  },
  async run() {
    return (await axios({
      url: `https://swapi.dev/api/films/${this.film}`,
    })).data;
  },
};

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
SWAPI - Star WarsswapiappThis component uses the SWAPI - Star Wars app.
filmfilmstringSelect a value from the drop down menu.

Action Authentication

The SWAPI - Star Wars API does not require authentication.

About SWAPI - Star Wars

The Star Wars API

More Ways to Connect SWAPI - Star Wars + Google Calendar

Get Film with SWAPI API on Event Start from Google Calendar API
Google Calendar + SWAPI - Star Wars
 
Try it
Get Film with SWAPI API on Event Search from Google Calendar API
Google Calendar + SWAPI - Star Wars
 
Try it
Get Film with SWAPI API on Event Ended from Google Calendar API
Google Calendar + SWAPI - Star Wars
 
Try it
Get Film with SWAPI API on New Event from Google Calendar API
Google Calendar + SWAPI - Star Wars
 
Try it
Get Film with SWAPI API on Event Cancelled from Google Calendar API
Google Calendar + SWAPI - Star Wars
 
Try it
Event Start from the Google Calendar API

Emits a specified time before an event starts

 
Try it
Upcoming Event Alert from the Google Calendar API

Triggers based on a time interval before an upcoming event in the calendar. This source uses Pipedream's Task Scheduler. See here for more information and instructions for connecting your Pipedream account.

 
Try it
New or Updated Event (Instant) from the Google Calendar API

Emit new calendar events when an event is created or updated (does not emit cancelled events)

 
Try it
New Event from the Google Calendar API

Emits when an event is created

 
Try it
Event Search from the Google Calendar API

Emit when an event is created that matches a search

 
Try it
Add Quick Event with the Google Calendar API

Create an event to the Google Calendar. See the docs here

 
Try it
Create Event with the Google Calendar API

Create an event to the Google Calendar. See the docs here

 
Try it
Delete an Event with the Google Calendar API

Delete an event to the Google Calendar. See the docs here

 
Try it
List calendars from user account with the Google Calendar API

Retrieve calendars from the user account. See the docs here

 
Try it
List Events with the Google Calendar API

Retrieve a list of event from the Google Calendar. See the docs here

 
Try it