The default code block for Airtable changes as an event source is really awesome! However it is a timer type block, and while that is generally fine, I’ll like to have to option to manually trigger it.
The context is that I use Pipedream to update a SaaS database, pulling data from Airtable. Before a certain function is run (which references the SaaS database) I’ll like to make sure the most up-to-date data (Airtable is the front-facing system where data is input into) is on the SasS database.
Would anyone know if this manual triggering of a timer block is possible?
You can use Airtable button field. Then setup a webhook action in Pipedream. Copy the URL to the Airtable’s button field and append fields in that row that you would need. Then when you click on the button, that row’s data would be logged to Pipedream.
@PTTB just to add to @zeshhaan’s recommendation, if you visit Sources - Pipedream and select your Airtable event source, you’ll see the option to Run Now, which runs the source immediately and fetches the relevant records you’ve added / updated since the previous run.
@dylburger I’m actually looking to hit that “Run Now” button programatically. Would you know if there was some way to do this in Pipedream, perhaps via the Pipedream API?
@PTTB there isn’t a way to invoke a timer-based event source programmatically in this manner, but I opened a feature request to track that here, if you’d like to follow that for updates.
@PTTB Since you can edit the code for any source on Pipedream, one option that may work for you is to add an HTTP interface to your Airtable source. This should allow you to programmatically trigger the source independent of the timer by making an HTTP request.
E.g., navigate to the Configuration tab for your source and add the following to props:
http: "$.interface.http",
NOTE: If you’re updating an existing source, I suggest adding this as the last prop (otherwise you may be prompted to reconfigure any props that are listed after it).
Once you save and return to the Events tab, you should see a unique endpoint URL listed that should allow you to trigger the source programmatically:
The source should now run on both the timer configuration as well as anytime you hit the endpoint URL. You can also optionally add code to the run() method for your source if you want to pass a token or shared secret to validate that any HTTP requests are coming from your app.
It seems that this workaround suddenly stopped working. For some reason, the Configurations code seems to be read-only now. Each time I try to update it by adding http: "$.interface.http", to props, the code reverts to default and my changes are not saved. Would anyone know why this is the case? @pravin