Trakt new watch trigger returning old viewings

I’m using the Trakt new-show-or-movie-watched trigger to add things I’ve watched to a Google Calendar. I have 2 workflows: 1 for movies and 1 for TV

The trigger is sending events for everything I’ve watched in the past decade+ but I’m only interested in new things. The workflow tester is showing 860 new events, but there are less than 10 in the past week. The deployed version is still iterating on the same old events.

Can I somehow ignore all the old stuff and only have this triggered by new events? I have a filter action right after the trigger to remove old things, but this is still burning through my quota

Hi @trioculus,

To handle this situation where your Trakt trigger is sending a large number of past events, you can use a filter to ensure that only new events are processed. Here’s a step-by-step approach to achieve this:

  1. Use a Filter Step: Since you already have a filter action right after the trigger, make sure it’s configured to check the date of the event. You can filter out events that are older than a specific date, such as one week ago.

  2. Data Store for Deduplication: Utilize a Pipedream Data Store to keep track of events that have already been processed. This way, you can ensure that each event is only processed once, even if it’s triggered multiple times.

Here’s an example of how you can implement this using a Data Store in a Pipedream workflow:

export default defineComponent({
  props: {
    data: { type: "data_store" },
  },
  async run({ steps, $ }) {
    const event = steps.trigger.event; // Assuming this is where your event data is
    const eventId = event.id; // Use a unique identifier for the event

    // Check if the event has already been processed
    const processedEvents = await this.data.get('processedEvents') ?? [];
    if (processedEvents.includes(eventId)) {
      return $.flow.exit('Event already processed');
    }

    // Add the current event to the list of processed events
    await this.data.set('processedEvents', [...processedEvents, eventId]);

    // Proceed with the rest of your workflow
    // For example, add the event to Google Calendar
  },
});
  1. Adjust Trigger Settings: If possible, adjust the settings of your Trakt trigger to limit the events to a specific timeframe. However, if the trigger does not support this directly, using the filter and data store as described above will help manage the flow of events.

  2. Monitor Quota Usage: Keep an eye on your Pipedream quota usage. If the filter and data store approach still results in high usage, consider optimizing your workflow further or reaching out to Pipedream support for additional assistance.

By implementing these steps, you should be able to filter out old events and only process new ones, thus conserving your quota. If you need further assistance, please visit Pipedream Support.

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.

@trioculus it seems there may be a bug in the trigger deduplication. It makes sense you don’t want to trigger old events and consume credits unnecessarily. Could you please file a bug in the Integrations section in Support - Pipedream?