How to call attributes?

#1

I’m new to Flow and have been following some of the tutorials. I’m stuck on this one – using attributes.

My flow is set up as follows:

  1. New Message (named: Music recommendations)

  2. Ask a question (genre)

  3. Ask a question (mood)

  4. Set an attribute
    genre > {{ask_for_genre.parsed_answer}}
    mood > {{ask_for_mood.parsed_answer}}

  5. Send message
    "I also like {{music_recommendations.attributes__genre}} when I’m {{music_recommendations.attributes__mood}}.

However, in the test console, the message is displayed as: “I also like when I’m .”
I’m confused because I think I followed that tutorial correctly, but it’s not getting the attributes that were just defined?

(Karen Barker) #2

Hi @devin1229,

If you’re using the values from a question in the same flow you wouldn’t actually need to reference the attributes. You could just use the {{ask_for_genre.parsed_answer}} and {{ask_for_mood.parsed_answer}} in the Send Message action.

When using attributes set in the same flow you cannot access them from the trigger (They weren’t set at the time the trigger output was created). You therefore need to be using the output of the Set Attribute action to reference these in a future action in the same flow.

If you’ve used GoTo labels in the flow so the attribute may have been set multiple times and you want the latest version of it then it’s a good idea to use a Get Attribute action and use the output of this action where you want to use the value of an attribute.

If you’re referencing an attribute set in a different flow then it will be the value set in the trigger output.