Skip to main content

How to set up a REST API action

Updated over 3 weeks ago

Summary

This article walks you through how to set up a REST API action in Wati. You will learn how to choose the right trigger, select an event type if needed, and correctly add the action to your AI agent’s instructions so it works as expected.

Instructions

A REST API action only works when it is configured correctly and added to your AI agent’s instructions. The setup process has 3 main steps:

  1. Choose how the action should be triggered

  2. Select an event type (if applicable)

  3. Add the REST API action to your AI agent’s instructions

Follow the steps below to complete the setup.

Step 1: Choose a trigger type

When creating a REST API action, the first decision is how it should be triggered.

There are 2 trigger types available:

Intent-based trigger

This trigger is used when you want the action to run based on what the user says.

  • Triggered when the AI agent detects a specific user intent during a conversation

  • Useful for actions like sending data when a user asks for a demo or shares interest

Parameter behavior: Dynamic placeholders can be used for API configuration.

Trigger mode: Currently, only agent_decides is supported. This means the AI agent decides when to execute the action based on the conversation context.

Event-based trigger

This trigger runs automatically when a predefined event occurs.

  • Triggered without relying on user intent

  • Useful for system-driven actions such as feedback or form submissions

Step 2: Select an event type (event-based only)

If you choose Event as the trigger type, you must select one of the supported event types.

Currently, Astra supports the following event types:

Positive feedback received (thumbs up)

  • Triggered when a user clicks the thumbs up option

  • Supports static parameters only

Negative feedback received (thumbs down)

  • Triggered when a user clicks the thumbs down option

  • Supports static parameters only

Form is submitted

  • Triggered when a user submits a Custom Form

  • Supports dynamic parameters passed from form fields

Lead captured

  • Triggered when lead information is collected during a conversation

  • Uses a fixed request body structure

Choose the event type that best matches when you want the REST API action to run.

Step 3: Add the REST API action to AI agent instructions

Creating a REST API action is not enough on its own. The action will not work until it is added to your AI agent’s instructions.

Required for all REST API actions

  • Add the REST API action to your agent’s instruction configuration

If the action is not included in the instructions, it will never trigger.

Additional requirement for “Form is submitted”

If you are using the Form is submitted event type, there is one extra requirement:

  • You must also add the related Custom Form to the agent’s instructions

  • Both the REST API action and the Custom Form must be included

If either one is missing, the REST API action will not trigger correctly.

Here's a quick overview of what to integrate depending on the event type:

Event Type

What to Integrate

Thumbs up / Thumbs down

REST API Action only

Form is submitted

REST API Action + Custom Form

Lead captured

REST API Action only

Intent

REST API Action only

Final checklist

Before publishing your AI agent, make sure that:

  • A trigger type is selected

  • An event type is chosen (if event-based)

  • The REST API action is added to the agent’s instructions

  • The Custom Form is added when using Form is submitted

Once all these steps are completed, your REST API action is ready to run automatically during conversations.

Did this answer your question?