Skip to main content

How to configure attributes & REST Action API payload

Summary

This guide explains how REST API action attributes work in Astra and how they are used within Astra agents. Attributes act as placeholders that store and pass data between instructions and actions.

You’ll learn the different types of attributes, how they behave, and how to use them correctly when configuring REST API (Representational State Transfer) actions.

Instructions

What is an attribute

In Astra, an attribute is a placeholder that stores a value. It allows your agent to dynamically use data during execution.

For example, attributes like first name or last name can store customer details and be reused in responses or actions.

Key points

  • Attributes act like variables inside your agent

  • They can be used in instructions and actions

  • In instructions, attributes are mainly used for clarity or structuring inputs and outputs

Input and output attributes

Attributes in Astra are categorized based on how they are used:

Input attributes

  • Provide data into an action or step

  • Example: passing a customer name into an API request

Output attributes

  • Store results returned from an action

  • Example: saving a response ID from an API

Both types can be referenced throughout your agent workflow.

A. Contact attributes

Contact attributes are a specific type of attribute linked to customer data.

Predefined contact attributes

Common examples include:

  • first name

  • last name

Custom contact attributes

You can create custom attributes based on your use case within the agent.

Important

  • Contact attributes only receive values when data is actually captured.

They are populated when:

  • A Custom form is submitted during the conversation

  • A REST API action is triggered after the conversation

Other important points to note

  • Contact attributes are not the same as contact fields

  • Contact fields include:

    • email

    • phone

  • They can also come from:

    • Custom forms

    • Lead qualification criteria

Contact attributes are linked to these fields only when data is captured through these flows.

B. Action attributes

Action attributes are tied to actions configured in your agent.

Types of action attributes

  • REST API action attributes

  • Predefined action attributes

1. Predefined action attributes

These become available when you add specific actions to your agent.

Examples:

  • Wati send sales summary → sales_summary_content (input)

  • Slack send message → message_content (input)

  • Google Sheets add row → inserted_data_id (output)

  • Google Sheets update row → target_data_id (input)

2. REST API action attributes

  • Input attributes are created when you configure the action

  • Output attributes are generated after the action runs (during testing or live execution)

Important

You must add the corresponding action to your agent before using its attributes.

How to configure REST API action payload

REST API actions in Astra use placeholders to pass dynamic data.

What are placeholders

Placeholders are written using: {{placeholder_name}}

You can use them in:

  • Query parameters

  • Headers

  • Request body

Recommended method: use data input

This is the most flexible and recommended approach.

A. Using Data Input

Step 1: add a data input field

Create a data input in your action configuration.

Step 2: configure the field

Define:

  • Data type

  • Name

  • Description

  • Mandatory or optional

  • Reference attribute (optional)

  • Default value (optional)

Step 3: choose how the value is sourced

You have 3 options:

  • No reference

    • The agent generates the value from context

    • Add a clear description so the agent knows what to pass

  • Reference a contact attribute

    • Use only if the value is already captured

    • Avoid using this unless:

      • A custom form was submitted, or

      • A post-conversation API event occurred

  • Reference an action output attribute

    • Use output from a previous action

    • The referenced action must run before the current one

Step 4: use the placeholder

Reference it in your payload: {{data_input_name}}

Make sure the name matches exactly.

B. Using direct contact attribute

You can directly reference a contact attribute: {{contact.attribute_name}}

  • No need to define a data input

  • Can be inserted directly from the UI

C. Using direct action attribute

You can reference an action’s output: {{action.<action_id>#out#<attribute_name>}}

  • Links to output from a previous action

  • Can be inserted from the UI

  • No need to manually type the full format

Best practices

  • Use data input for most use cases

  • Avoid relying on contact attributes unless you are sure they are populated

  • Ensure action execution order is correct when using outputs

  • Test all API actions before deploying

By understanding Astra attributes, you can build more structured, reliable, and dynamic agents inside Wati.

Did this answer your question?