pipedream icon indicating copy to clipboard operation
pipedream copied to clipboard

[Refactor / Improvement] Add GET request to certain Instant Webhook-Based Sources

Open dannyroosevelt opened this issue 2 years ago • 1 comments

Problem: Many of our webhook-based sources (Telegram Bot for example), require users to manually trigger an eligible event to get picked up by the trigger, in order for a test event to show appear when they're building a new workflow. This is not always obvious to the user, so when they can't figure out how to do this, sometimes they give up.

Solution: We should do this automatically for users whenever possible, by fetching historical data from the relevant GET endpoint on the deploy() hook, then on activate() we create the webhook like normal (Andrew did this for Gorgias here, and we already do this for Google Sheets, Slack, and a couple other apps). We should fetch the most recent 25 events and order them in descending order of recency.

Note: The shape of the event can be different for the event that arrives via webhook vs. the event retrieved via the REST API. Ideally we should format the events returned from the REST API in the same way as they would normally arrive via webhook, so that the shape of the event emitted from the source is the same in both cases. If this is overly difficult or not possible, please flag that in the appropriate ticket.

Apps to implement this strategy in (in rough order of priority):

dannyroosevelt avatar Jul 06 '22 22:07 dannyroosevelt

This is implemented in Gorgias here.

andrewjschuang avatar Jul 07 '22 00:07 andrewjschuang