Use Plex webhooks via pipedream to send message to pushover

I’d like to trigger on receipt of a webhook from Plex and send a message to Pushover, dependent upon type of payload received (as define in the payload) and using some of data fields from the payload. Programming newbie I can’t determine how to access and examine/use the payload data once triggered.

Hi @dean,

You can achieve this by creating a Pipedream workflow with an HTTP trigger to receive the webhook from Plex and then use a code step to process the payload and send a message to Pushover based on the payload data. Here’s a step-by-step guide:

  1. Create a new workflow in Pipedream.
  2. Add an HTTP trigger to receive the webhook from Plex.
  3. Add a code step to process the payload and send a message to Pushover.

Here’s the complete code for the code step:

import { axios } from "@pipedream/platform";

export default defineComponent({
  props: {
    pushover: {
      type: "app",
      app: "pushover",
    },
  },
  async run({ steps, $ }) {
    // Access the payload from the HTTP trigger
    const payload = steps.trigger.event.body;

    // Define the conditions to send a message to Pushover
    if (payload.event === "media.play" && payload.Metadata.type === "movie") {
      const message = `A movie is being played: ${payload.Metadata.title}`;

      // Send a message to Pushover
      return await axios($, {
        method: "post",
        url: `https://api.pushover.net/1/messages.json`,
        params: {
          token: `${this.pushover.$auth.api_token}`,
          user: `${this.pushover.$auth.user_key}`,
          message: message,
        },
      });
    } else {
      return "No action taken";
    }
  },
});

Explanation:

  1. HTTP Trigger: This step will receive the webhook from Plex. The payload will be available in steps.trigger.event.body.

  2. Code Step: This step processes the payload and sends a message to Pushover if the conditions are met.

    • The payload variable contains the data received from the Plex webhook.
    • The if statement checks if the event is media.play and the type is movie.
    • If the conditions are met, a message is constructed and sent to Pushover using the axios library.

Using the Pushover App (trigger|action)

  1. Search for the Pushover app from the step menu.
  2. Select the Push Notification action.
  3. Connect your Pushover account.

I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double-check my answers and code! Learn how to build your own.