Skip to main content

Can not run custom action from custom trigger

  • March 15, 2023
  • 4 replies
  • 622 views

Hi,
I have custom trigger: [When subitem created] that will create webhook [create_subitem]
and custom action: [Create an item (item mapping field) in board and…]
Then I created a recipe [When subitem created, create an item in board and…]
When I create a subitem, it run into the trigger, then post to “https://api-gw.monday.com/automations/apps-events/{subscriptionId}” but it is not run into the custom action (create an item in board and…)
I tried my custom action with built-in trigger like: [When column changes, create an item in board and…], it works very well.
I tried a lot of options, but can’t seem to get it right.
Thanks in advance for the help. If anything needs clarification, please let me know.

4 replies

basdebruin
  • Community Expert
  • March 15, 2023

hi @mhung21

Looks like the correct setup. When you received the post from the webhook in your endpoint (specified in the create_subitem webhook creation) you post to the subscriptions endpoint.

Are you sure you use the correct subscriptionId to post to? SubscriptionIds are not unique (can have duplicates in different regions) so it is safer to post to webhookUrl that you got in the subscribe event (and need to be stored for later access).

When posting from youw webhook endpoint to the action you need to specify all the input variables expected by the action endpoint. Did you check those? This is an example how you could post from the webhook endpoint to your action endpoint.

  //Build the post body
  const postBody = {
    trigger: {
      outputFields: {
        boardId: event.boardId,
        itemId: event.pulseId,
        failedId: null,
      },
    },
  };

  //Post the request
  var options = { headers: { Authorization: envVars.signingSecret }, json: true };
  needle("post", myConfig.webhookurl, postBody, options);

In this case the action expects: boardId, itemId and failedId.

Hope that helps.


  • Author
  • New Participant
  • March 15, 2023

Thanks @basdebruin,
I’m using webhookUrl, post all the input variables,… and other recipe is working fine. Only this recipe still not working. I found that the action is using Item Mapping field, I remove it and the application work, it run into the action.
I don’t know why. Is this monday’s problem or Am I setup wrong somewhere?


  • Author
  • New Participant
  • March 15, 2023

Oop, I know why.
outputFields I need assign something to itemMapping but I leave it empty/null so it wasn’t working.

{
                    trigger: {
                        outputFields: {
                            boardId: boardId,
                            itemId: itemId,
                            itemMapping: {}
                        }
                    }
                }

Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • March 15, 2023

Hello @mhung21,

If I understand correctly, you found the source of the issue and could work it out. Correct?