How to add a userId to remote options url payload

I am creating a custom field type in my integration that derives values from a remote options url. The payload for the remote options field looks like this { recipeId: 30019598123, integrationId: 72966189123, automationId: 72966189123, pageRequestData: {}, dependencyData: null } . This is insufficient for my use case as my application need to know which user has triggered the custom field. I have tried to use the dependencies but that seems to require a manual user input.

Is it possible to automatically add a userId value to the payload that is sent to the remote options url?

Hi @Keem

You are on the right track by adding a dependency. In your custom field (where you define the Remote Options Url) add a dependency of type User (field id is userId). When you define your workflow block you add this custom field to it and define the source (probably a recipe input if I understand your use case).

Now, when you create your recipe and use the workflow block you have to setup the dependency. It can either come from the Trigger (in case you use a custom trigger the User field should be part of the output for that trigger to be able to select it as a dependency). When using a custom trigger (with webhooks) don’t forget to put the UserId in the payload of the post to the monday action. The userId can be derived from the webhook event.

1 Like

Thanks for the reply. In my recipe sentence, I am using a built-in trigger and a custom action. The custom action has a custom field that sends a payload to my remote options url. I will like to have a userId of the user configuring the recipe as part of the payload that is sent to my remote options url. I do not want the user to input his or her user id manually.
I want the userID to be added automatically. Following your answer, the user will still have to manually add the userid when configuring the recipe sentence.

Is it possible to automatically add a userId value to the payload that is sent to the remote options url?

My example was based on a custom trigger. The userId is passed from the event (from the webhook created by the custom trigger) to the action. For the dependency you can select the tigger output User. As there is no trigger input User the user will not have to fill in the userId.

With a built-in trigger you can still select the trigger > userId (if the built-in trigger supports that field). Most of the built-in triggers sends the userId in their output, so you should be able to selecte trigger > userId as the dependency when you create your recipe.

You can easilly check that by taking the built-in trigger you want and use the action “notify (with item and user)”. If you can select a userId in that action, the tigger apparently sends the userId so you should eb able to select that.

I am confused on how to do this. I have created a screencast to explain on what I am trying to do https://vimeo.com/748780753

Hey @Keem
If you use triggers provided by monday, here’s the userId set in the custom block:

And here how you use it in the “trigger>action” recipe:
Screen Shot 2022-09-12 at 15.58.03

Once you receive the call from monday, you’ll get the corresponding userId in the payload:

hi @Keem, like @rob shows.

I watched your video and I noticed you have a custom action which uses a sentence where “notify” is not a field. I noticed that on 0:44 in your video.

image

Then - at 3.40 in your video - you show the integration recipe and here “notify” is a field. Are you 100% sure that during the recipe build you picked your own custom action and not a standard monday one?

Also, I don’t see the dependencies in your custom field. You have to add e dependencie to the userId to get the userId in the payload.

Thanks for the help. I followed your solution and I get the right payload to my custom action run url. That solved one of the two issues I had. I am still stuck at adding the userid automatically to the payload that is sent to the remote spaces url in the custom field

I have created another dependencies to demonstrate the issue I am facing with dependencies

hi @Keem
You don’t really need that second field “User”. The dependency for the custom fields looks fine to me but I am not sure the standard “Item creation” trigger returns the user object. Can you try to replace (just for testing) with the standard “Status change” trigger.

I just tried it out, "Status change’ and all the other triggers I tried dont return the user object

I am also wondering how I can get details like the item name, board name and username into the payload that is sent to the run url. At the moment, I can only get the id’s like you demonstrated.
Do I have to make api calls for the names with the ids I receive in the payload?

hi @Keem
I just tested this with one of my existing apps and it looks like the userId can’t be used as a dependency. I get the same empty select box. I suggest to mail to (app)support on this one.

1 Like