Retrieve itemId created by custom trigger

Hi. We are using Custom Triggers to create items when the user performs an action in our service. However, our users are requesting that the items are updated if they make a change in our external service (e.g. if the object they created in our service was deleted). Is it possible to retrieve the itemId for the item created by the custom trigger? If not, how can we refer to and update the item that got created?

hi @CatchApp-Oliver

Welcome to the community. When you create an item using the API (triggered from your system) you will get a return value. As an example: this API call:

mutation {
  create_item(item_name: "new item", board_id: 8514569782) {
    id
  }
}

returns this:

{
  "data": {
    "create_item": {
      "id": "265489123"
    }
  },
  "account_id": 123456
}

Is that what you are looking for?

Hello @CatchApp-Oliver!

Welcome to the community. I hope you like it here :muscle:

I think what @basdebruin suggested is a good solution for this. You would have to use a custom action for this, that creates the item (and receives the item’s ID once it is created). Thank you @basdebruin!

Cheers,
-Matias

Hi. Thanks for your reply, but I think you may be looking at a different API. This is what we’re using to send data to monday.com from our app: Custom Triggers

Custom triggers do not use the GraphQL format, and don’t seem to return any data about what was created. The user connects their integration using a JWT, then we send a POST to monday.com with the data from our side, but we don’t have any credentials for reading from their monday.com boards.

Hi Oliver,

The example I gave was from the API playground, there is only one API :slight_smile:.

When you build your custom trigger in monday using the trigger builder you have to define endpoint for subscribe and unsubscribe. Within the subscribe endpoint you can call the API. What you show here is just the POST to trigger but where is your code (endpoint) doing the API call?

Interesting, thanks! I don’t see that option listed anywhere on the Custom Triggers page. So do you mean we can use the short-lived token from the JWT header to make a GraphQL request to the subscribe URL to fetch the item ID of the object created by our trigger?

Reading further about the .get API, it looks like we maybe call it with typeitemIds’ and a blank params option to get a list of all itemIds, then we just sort that by descending order of date to get the most recent