I'm working with the CLI version of Zapier and I have a question concerning the bundle.inputData.
The scenario is as follows:
- I have a hidden trigger, that fetches a list of campaigns (id, title, token) that creates a dropdown for the the user to select the campaign where new contacts should be created in our app.
- I have a "contact create", that makes an API call creating new contacts in the selected campaign.
The tokens, that are returned in (1) have a lifetime of one hour, so if they expire I have to fetch new tokens. Unfortunately this hidden trigger is only called once, that is when the user creates a new zap and selects the destination campaign.
It it somehow possible to call that trigger from within my "contact create", so that I can update those tokens, if they are expired?
Best answer by ikbelkirasanView original
I think that you should fetch the campaigns list in your `contact create` action to get the token that matches the selected campaign ID before calling the API to create contact. It might sound like a redundant work, but the purpose of the hidden trigger you set up is actually to help the user see a list of the available campaigns. This is only called at design time when the user is setting up the zap, which implies that you should fetch the campaigns list on every run of the `contact create` action.