The Notification Receiver and the Message field not working properly inside recipe sentence

I try to build a integration. I made a recipe using a custom action I made, I attached a picture of it.

I got some problems using the field I mentioned in the question.

  1. Notification Receiver does not works if I select a field instead of a person. My field is of type people but I receive no information about the content of the column.
  2. Message field does not send any auto-populated fields. This is how it is set-up
    image

This is the json I receive in my backend:
{
“payload”:{
“blockKind”:“action”,
“blockMetadata”:null,
“inboundFieldValues”:{
“boardId”:1112637424,
“receiver”:{
“type”:“column”,
“value”:“people0”
},
“message”:"{pulse.name}|{board.name}|{user.name}|{pulse.group}|{pulse.people0}|{pulse.status}|{pulse.timeline}|{pulse.numbers0}|{pulse.numbers45}|{pulse.status_1}|{pulse.dropdown4}|{pulse.date_1}|{pulse.labor_budget_spent}"
},
“inputFields”:{
“boardId”:1112637424,
“receiver”:{
“type”:“column”,
“value”:“people0”
},
“message”:"{pulse.name}|{board.name}|{user.name}|{pulse.group}|{pulse.people0}|{pulse.status}|{pulse.timeline}|{pulse.numbers0}|{pulse.numbers45}|{pulse.status_1}|{pulse.dropdown4}|{pulse.date_1}|{pulse.labor_budget_spent}"
},
“recipeId”:1137626,
“integrationId”:37553360
}
}

Hey @catalin,

That’s a great use case!

One thing I’ve noticed right off the bat is that your custom action is not using any Item IDs, so it would not be possible for the integration recipe to pick up the column values of the item this relates to.

In general, when building integration recipes like this one out, you will need to query the column values of the board in order to get the values you are looking for. For example, to send the notification to the correct person, you would need to query the value of the column that is selected as the Notification Receiver, and then use that value in your app. To use the references to other columns in your Message block, you will also need to query the actual column values of those columns, and then parse them in your action. Here’s how the quickstart queries for column values:

const getColumnValue = async (token, itemId, columnId) => {
  try {
    const mondayClient = initMondayClient();
    mondayClient.setToken(token);

    const query = `query($itemId: [Int], $columnId: [String]) {
        items (ids: $itemId) {
          column_values(ids:$columnId) {
            value
          }
        }
      }`;
    const variables = { columnId, itemId };

    const response = await mondayClient.api(query, { variables });
    return response.data.items[0].column_values[0].value;
  } catch (err) {
    console.error(err);
  }
};

Does that make sense? I hope this helps. :slight_smile:

-Alex

1 Like

I will look into your solution. How about my second problem?

And for your first answer. A link to the docs will help more than node code or at least the query as it is in the playground. I code in PHP

@catalin

To clarify further, the message that you input will not be auto-populated by default. You will need to run a query in order to get the values that the item currently has. For example, item.numbers0 => column value of the item from the column with Numbers0 ID, and then input that into the message. Does that make sense?

Perhaps the PHP quick-start would be more helpful in this case as far as building out your queries gos?

It will walk you through building your queries out in PHP to get column values and general queries. I hope this helps!

-Alex

Hi Alex,

questions about this: do I understand it right, that an integration, that wants to query some information about a users board, e.g. to replace some placeholders in a message with the proper values, needs the API token of the user?
And if so, what is the correct way to provide the token to the integration?
Could it be possible to populate such a message with placeholders before sending it to an integration (or as part of an integration)? E.g. as an intermediate step?
I ask, because with an API token, an integration has full read and write access to the users board(s), which I would not recommend (to protect users data).

Update: after reading the documentation I understand, that the integration gets a short living token in the JWT to access the API. So no token of the user is needed. And it seems, that the integration can only access the data of the board where installed, right?

Thanks in advance, Marcus

Hey Marcus – welcome to the community!

What you said in the second part of your post is exactly right – when the monday server sends a request to your integration endpoints, we’ll supply a shortLivedToken that is scoped according to the app and is valid for 1 minute. That token will only have read/write access to a user’s boards if your app has the boards:read and boards:write scope.

You can use this token to make API calls and it should accomplish 90% of use cases for an integration.

For a rundown of the various auth methods we support, check out this article: Choosing Authentication Methods

1 Like

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