Re: Custom Trigger tutorial wrong?

@dipro Hey, just wanted to ask a question about your response on this thread.

You said that the response body of the POST request to the webhookUrl would include the itemId if the created item. All I’m receiving back from this endpoint is { success: true }.

Is this expected behavior?

Cheers,
Chris

1 Like

Hi @mrautomation!

Happy to chime in here.

Just to confirm: are you referring to the payload in @Dipro’s screenshot? Or are you referring to the updated screenshot on our Custom Triggers page?

It looks like the post included an incorrect payload body.

The body you should be expecting should follow the example on the Custom Triggers page.

Hope this helps~

@Helen

The screenshot on the Custom Triggers page refers to a “Body” and I’m not sure if it refers to the Request Body or the Response Body for when you call the action:

I would think it was the Response Body because it wouldn’t make sense to pass an “itemId” in the “Request Body” because at that point you wouldn’t know the id of the item you are creating.

It would be great if this was the Response Body because then we could use that item ID to reference in the future for an update.

Right now it’s just returning { success: true }. Let me know if that is the expected behavior.

I am using the “Creating an item with mapping” action btw.

Oh! Okay, apologies, I see what you’re referring to now.

Yes, so the “Body” payload in this case is what your trigger will send after it’s been issued/triggered.

The example body in the article was maybe a bit confusing haha. If I’m thinking of an example/analogy that could fit with that payload body, it would be something like: “When an item is updated on a board, create an item with mapping.”

In this example, after I update an item on a board, the board’s webhook would then return the item and board data.

As such, if your custom trigger is pulling in information from a different platform, you are correct in that there wouldn’t be an item Id in that trigger (since the payload only contains info about that other platform), if that makes any sense?

“Yes, so the “Body” payload in this case is what your trigger will send after it’s been issued/triggered.”

Unfortunately, I’m still not getting the correct response body back. I’m only getting { success: true } and not the payload containing the item ID.

@dipro @Helen I apologize if I’m not communicating effectively. Let me know if you need me to send a Loom video.

Hi @mrautomation,

Sorry, I think I’m misunderstanding. Are you looking for the item Id to be posted back to your trigger endpoint after the trigger has been initiated…? Or where would the item Id be coming from?

If you take a look at our GitHub example code, you can see in the monday-triggers-service.js file the formatting of the trigger data that is being sent for the recipe “When an issue is created in GitHub, create an item in monday.com”:

const triggerMondayIntegration = async (webhookUrl, data = {}) => {
  fetch(webhookUrl, {
    method: 'post',
    headers: {
      'Content-Type': 'application/json',
      Authorization: process.env.MONDAY_SIGNING_SECRET,
    },
    body: JSON.stringify({
      trigger: {
        outputFields: {
          ...data,
        },
      },
    }),
  });
};

In this example, the payload sent from the trigger to the action would not contain the item Id, since the data is coming from GitHub! Is this where you were expecting to see an item Id?

Taking this same example then, the trigger endpoint would not receive a payload containing the item Id of the newly created item because this is handled by the action endpoint.

Hi @mrautomation,

Since we haven’t heard from you on this thread in a while, I’m going to close this.

Please do let us know if you continue to run into any areas of confusion/have questions about this! Happy to continue digging into it.

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