The Meya Developer Hub

Welcome to the Meya developer hub. You'll find comprehensive guides and documentation to help you start working with Meya as quickly as possible, as well as support if you get stuck. Let's jump right in!

How to store scope data

Each of the three scopes which can be written to at runtime have an associated component for storing data on it:

Scope

Component

Documentation

flow

flow_set

thread

thread_set

user

user_set

📘

These aren’t the actual names of the components, rather they are the signature property of their respective components. Signature properties give developers a shorthand way to refer to a component.

To store data in a scope, use the appropriate *_set component. They accept either the name of a variable, or a dictionary of variable names and values. Both methods are described below.

Using a string

Many triggers and components will output data to flow.result. Often you’ll want to move that value to another location, otherwise it will be overwritten the next time a trigger or component runs. This is such a common pattern that we’ve added some syntactic sugar to the *_set components to make this even easier.

So this:

- SCOPE_set: VARIABLE

is equivalent to this:

- SCOPE_set:
      VARIABLE: (@ flow.result )

Example 1

In this example, we ask the user for their name. Their response is stored at flow.result, which we then save to user.name using the user_set component.

steps:
  - ask: What is your name?     # The user's input is saved to flow.result
  - user_set: name              # Set user.name to flow.result
  - say: Hello, (@ user.name )!

Example 2

In this example, the Dialogflow trigger stores the matched intent at flow.result, which we then move to flow.intent.

triggers:
  - integration: integration.dialogflow
    expect: dialogflow

steps:
  - flow_set: intent
  - say: The intent is (@ flow.intent )

Using a dictionary

Sometimes the value you want to store is not located at flow.result. Or you may want to set multiple variables at the same time. To do this, provide the *_set component with a dictionary:

steps:
  - flow_set:
      foo: bar
      count: 1

Updated about a month ago

How to store scope data


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.