Select to view content in your preferred language

Get token from survey

1319
5
01-05-2023 07:12 AM
JuanEsquivel
New Contributor

I am trying to get users attachments and send them to email via power automate. We don't have premium features for power automate. We can't use HTTP to be able to send the attachments the correct way. We are able to get the attachment to be sent but we cannot open it because of the missing token. We bypassed this temporarily by setting a static token, but this only works for a day. So my question is, can I pull the token URL from the form and set it as an attribute that way I can access it using the web hooks?

I used a type calculate and in the calculation field, I tried settings pulldata(‘@property’,’token’), but this doesn't seem to work. If you can point me to the right direction it would be appreciated

 

JuanEsquivel_0-1672931372134.pngJuanEsquivel_1-1672931428148.png

 

5 Replies
ChristopherCounsell
MVP Regular Contributor

Tokens can be included as part of the webhook payload information under portalInfo. 

https://doc.arcgis.com/en/survey123/browser/create-surveys/webhooks.htm#ESRI_SECTION1_65E73F50308841...

Go to the Survey123 website, manage the survey, and check portalInfo. A token should become part of the webhook payload. You will need to redownload the survey and maybe refresh the webhook connection in automate.

0 Kudos
JuanEsquivel
New Contributor

Hey magisian,

That box is checked, and the connection prior to it was refreshed. It seems when I test my flow the portalinfo is not being sent. I believe if its done internally where our portal is setup it sends the token. If someone outside the network no token is being sent.

0 Kudos
ChristopherCounsell
MVP Regular Contributor

If it works for some users but not others it suggests it's tied to your environment or the user.

Are these users outside the network logged in or public? Public users won't have a token.

You could also add a http request to your webhook to generate a token. Set a flow of token = pass, no token = http request to generate a token. Then set the token. 

0 Kudos
rsun_TQB
Frequent Contributor

Hi @ChristopherCounsell ,

Does this mean public facing survey123 is not going to be able to extract attachment using Power Automate since the token is going to be empty/null.

I built a public facing Survey123 form, and now I found that my Power Automate workflow only work for organizational users with credentials. 

Is there a work around of this? 

Thanks tons!

Reno

 

0 Kudos
ChristopherCounsell
MVP Regular Contributor

If your layer is publicly accessible (for queries), you should not need a token:
https://community.esri.com/t5/arcgis-survey123-blog/survey123-tricks-of-the-trade-working-with/ba-p/...

If your survey is from the public, so no token is passed, but the layer you are querying is private (token required), you won't be able to use a token that doesn't exist to request the photo. You could consider embedding a user/password in the power automate webhook to request a token that can be used to request the image. Personally, not a fan of doing this.

0 Kudos