Custom Trigger tutorial wrong?

Hi @krishna

I struggled a little bit with the same. I helps me enormously when thinking of a custom trigger like this.

The subscribe / unscubcribe is just used for houskeeping. During the subscribe you get the subscriptionId that you need store it somewhere. This subscriptionId can be used in the unsubscribe request. Mind you in the unsubscribe request the subscriptionId is called “webhook”.

In the subscribe event I create a webhook in the board and in that post request I specify the URL (let’s call this endpoint ACTION) which needs to be called when the webhook triggers. So, this results in a request to my endpoint ACTION when the webhook I inserted fires.

In the ACTION endpoint I do some checks and if needed I post to the subscriptionId I got from the subscribe event. This post needs an authorization header and a body. The body needs to contain the output (!!) fields specified in the custom trigger.

When you configure the action part of your recipes the output fields of the trigger are available in the action builder (trigger output / fieldname).

It gets a little more complicated when your action is a custom action. The URL specified in the builder will be called with the output fields of your trigger available in the post body (inputFields).

Hope this makes it a little more clear, kind of hard to get your head around this.

2 Likes

@basdebruin Thanks very much for this explanation…

One doubt is you said “we need to send output fields specified in the custom trigger.”
Do you mean we should send the fields which we defined while creating a recipe or we need not to define any output fields…all fields which ever we want can be sent to the action from our trigger.

Hi @krishna

The action part of the trigger has a number of fields configured. These fields comes either from the recipe sentence or from the trigger output. The example below gets its field boardIdMaster from the Trigger output field key with the same name.
image

Remember your code act as the trigger, so when you post to the action (by posting to the subscriptionId in the subscribe event) you need to supply the output fields of the trigger so the action get those as input fields.

If you don’t specify the output fields in the trigger builder, the action builder would not be able to populate the dropdown box indicated by the arrow. It looks kind of redundant but:

  • you need to specify the field in the output of the trigger, so the action configuration can find it in the dropdown box “Trigger output field key”
  • you need to put them in the post request to the action (by subscriptionId) so the action gets the value your code supplied to the field

Does that makes sense?

Makes sense @basdebruin Thanks for explaining things clearly :blush:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.