Unable to get an attribute in other flow

(Dmitry Yemelyanov) #1

Hi Team!

I have several flows:
Auth stands for parsing webhooked data. Shortly there’re two steps of oAuth2: first to get code from webhook, second for getting access token.
Get projects stands for making calls.
After retrieving of an access token I’d like to store it into attribute for further purposes.
In logs i can see, that It’s stored properly.
But I can’t reach it from my Get projects flow.
Attribute seems to be empty:


What am I doing wrong?

(Kellsey Shaw) #2

Hi Dmitry,

Can you show me the logs for when you set the attribute?

(Dmitry Yemelyanov) #3

I found that I can hardcode Response Path, getting it from logs before.

Is it normal approach, or I’d better type {{bot_new_message.response_path}} instead? While my main trigger is called Bot - New Message:

(Kellsey Shaw) #4

Hi Dmitry,

The first flow should use the Attributes > Set an Attribute. The attribute should be set using the response path from the list. This will always be the response path of the user speaking to the bot.

Your other flow(s) must not be started before this flow has finished or at least got past the point of setting the attribute. This is the only time that the attribute would not be available on other flows when it is the same user with the same response path.

(Dmitry Yemelyanov) #5

Yes, that’s clear.
And I wonder if Response Path should be set directly, e.g.
584a981f9168f5000c033133/c/198987442 or formula-based, like {{bot_new_message.response_path}}.

(Kellsey Shaw) #6

Hi Dmitry,

If you’re using the response path you shouldn’t need to set it. By default, it will be selected in the drop down list. :thumbsup:

(Dmitry Yemelyanov) #7

Under webhook flow there’s no available response paths. So to set attribute I have to enter path manually.

(Kellsey Shaw) #8

Hi Dmitry,

I see now. :thinking:

I think the structure of your flows or how you set the attribute might need to be changed. I’ll explain the possible issues:

  • If you’re using a separate flow to do the webhook action, you don’t have the response path but you can pass it to the flow - This is actually setting a token per user, though.

  • You could be requesting a new token too soon by doing it per user.

  • And if requesting a new token causes the previous to become invalid, this is also likely to be a problem especially if you have a lot of users.

What might be better is if you set the token in a global attribute. You just need to give it a unique name instead of the response path like MyToken. You can then use that attribute regardless of who the user is.

If the token has an expiry time, you can use the Dates and Times service to calculate the expiry and set that in a second attribute. So, you’d get the expiry date and token, if the current time was greater than the expiry time you’d then request a new token and update the two attributes :thumbsup:

Hopefully, this all makes sense

(Dmitry Yemelyanov) #9

I can’t make a global attribute, as because my API requests will return same data for all users. And that’s wrong while each user has individual data.

Just for my information: response path is required attribute, and I have to fill it. So how can I set attribute globally, what should I set for the response path?

Good catch! I just was thinking about this.

(Kellsey Shaw) #10

Hi Dmitry,

You will need to ensure that you pass the response path to the flow that is doing the webhook action. This should then be used to populate the response path field for the attribute :thumbsup: