# Actions

{% hint style="info" %}
This feature is currently available to enterprise tiers only.
{% endhint %}

### What's an Action?

Actions are the one-way cousins of *Data requests*. While *Data requests* can retrieve and send content from an external source and must have a defined response body, *Actions* only send content. They perform external tasks and merely inform NLX on whether or not the call was successful. *Actions* are useful for specific external tasks:

* Sending an email or SMS
* Triggering Robotic Process Automation

To access, click *Resources* in your workspace menu and choose *Actions*:

{% @arcade/embed flowId="0OFRDtNdx6mZ7KfMgut4" url="<https://app.arcade.software/share/0OFRDtNdx6mZ7KfMgut4>" %}

## Requirements

* [ ] Complete the *Action*'s implementation
* [ ] Set up the *Request model* schema
* [ ] Trigger via the [*Action* node](https://docs.nlx.ai/platform/nlx-platform-guide/overview/nodes#action) in a flow

## Implementation

The Implementation tab defines how your Action behaves when triggered in a flow. When a conversation reaches an Action node, NLX sends a POST request to the specified URL or returns a static response, executing the required process.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><i class="fa-infinity">:infinity:</i></td><td><strong>Static mode</strong></td><td>Choose to define a fixed JSON response. Ideal for prototypes or quick testing. Simply enter the response and click <em>Save</em></td></tr><tr><td><i class="fa-plug">:plug:</i></td><td><strong>External mode</strong></td><td>Choose to integrate with an endpoint. Enter URL + optional custom headers. Use the CloudFormation template in the <em>Instructions</em> section and click <em>Save</em></td></tr></tbody></table>

{% hint style="info" %}
For external implementations, enabling the *Dynamic* toggle lets you edit header values directly from the Action node’s side panel when the Action is triggered in a flow.
{% endhint %}

{% hint style="info" %}
If you’re working with sensitive data or reusing the same endpoint frequently, [store it as a *Secret*](https://docs.nlx.ai/platform/nlx-platform-guide/flows-and-building-blocks/advanced/secrets) in your workspace for added security and easier maintenance
{% endhint %}

{% @arcade/embed flowId="OnU4FGR7haU5HYIogpFy" url="<https://app.arcade.software/share/OnU4FGR7haU5HYIogpFy>" %}

<details>

<summary><strong>API spec</strong></summary>

HTTP payloads that are delivered to your *Action*'s configured URL endpoint contain several headers, including:

<table><thead><tr><th width="308">Header</th><th width="109">Value</th><th>Description</th></tr></thead><tbody><tr><td><code>Content-Type</code></td><td>application/json</td><td>The only content type currently supported is JSON</td></tr><tr><td><code>nlx-webhook-version</code></td><td>v3</td><td>The version associated with the action configuration</td></tr><tr><td><code>x-nlx-botId</code></td><td>&#x3C;uuid></td><td>A unique identifier of an application</td></tr><tr><td><code>x-nlx-channelId</code></td><td>&#x3C;uuid></td><td>A unique identifier of the channel associated with the application</td></tr><tr><td><code>x-nlx-channelType</code></td><td>string</td><td>A human friendly label indicating the channel type in use such as <code>API</code>, <code>AmazonChime</code> or <code>Genesys</code></td></tr><tr><td><code>x-nlx-conversationId</code></td><td>&#x3C;uuid></td><td>A unique identifier of the conversation that triggered this action</td></tr><tr><td><code>x-nlx-correlationId</code></td><td>&#x3C;uuid></td><td>A unique identifier that can be used for debugging</td></tr><tr><td><code>x-nlx-deploymentKey</code></td><td>&#x3C;uuid></td><td>A unique identifier of the deployment associated with the application</td></tr><tr><td><code>x-nlx-intentId</code></td><td>string</td><td>The intent ID from where the action has triggered </td></tr><tr><td><code>x-nlx-languageCode</code></td><td>string</td><td>The application's <a href="../translations#supported-languages">language code</a> used in the current conversation</td></tr><tr><td><code>x-nlx-userId</code></td><td>string</td><td>A user identifier such as a E.164 format phone number, UUID or other formats depending on the channel type</td></tr></tbody></table>

The body of the request your webhook will receive may contain the conversation context (`nlx_context`) if the send context option is enabled in the action settings. It will always include the properties defined in the *Action*'s *Request model*.

<table><thead><tr><th width="270">Name</th><th width="100">Type</th><th width="360">Description</th></tr></thead><tbody><tr><td><code>nlx_context</code></td><td>object</td><td>The conversation context containing essential values such as the <code>conversationId</code> and any <a href="../context-variables#use-a-context-variable">context variables</a> that have been set up to this point in the conversation.</td></tr><tr><td><code>nlx_context.botId</code></td><td>string</td><td>A unique identifier of an application</td></tr><tr><td><code>nlx_context.channelType</code></td><td>string</td><td>A human friendly label indicating the channel type in use such as <code>API</code>, <code>AmazonChime</code> or <code>Genesys</code></td></tr><tr><td><code>nlx_context.channelId</code></td><td>string</td><td>A unique identifier of the channel associated with the application</td></tr><tr><td><code>nlx_context.conversationId</code></td><td>string</td><td>A unique identifier of the conversation that triggered this action</td></tr><tr><td><code>nlx_context.languageCode</code></td><td>string</td><td>The application's <a href="../translations#supported-languages">language code</a> used in the current conversation</td></tr><tr><td><code>nlx_context.&#x3C;attributeName></code></td><td>string, number or Boolean</td><td>A set value of a custom context attribute. The attribute name can be an alphanumeric string with dashes and underscores</td></tr><tr><td><code>&#x3C;propertyName></code></td><td>any</td><td>One or more set values corresponding to the schema defined in the action's request model</td></tr></tbody></table>

The response body of your *Action* can optionally include the following properties:

<table><thead><tr><th>Name</th><th width="131">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>context</code></td><td>object</td><td>A map of key value pairs that you would like to be set as <a href="context-variables">context variables</a></td></tr><tr><td><code>context.&#x3C;attributeName></code></td><td>string, number, or Boolean</td><td>A set value of a context variable. The name can be an alphanumeric string with dashes and underscores</td></tr></tbody></table>

For example, the response body of an *Action* may look like this:

```json
{
    "context": {
        "SmsSent": true
    }
}
```

</details>

## Request model

The *Request model* defines the payload structure your *Action* sends when making an API call. Each field represents data that can be sent to your endpoint and can be populated dynamically during a conversation. For example, if a user provides their name, you can include it in the request body to personalize a welcome email or other message.

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td><i class="fa-sparkles">:sparkles:</i></td><td><strong>Auto-generate schema</strong></td><td>Quickly define your request schema by selecting <em>Auto-generate</em>, pasting a sample JSON payload, and clicking <em>Save</em>. NLX automatically builds the schema based on your provided structure</td></tr><tr><td><i class="fa-pencil">:pencil:</i></td><td><strong>Manual schema</strong></td><td>Choose to define your request schema field by field. Use <em>+ Add field</em> to create new properties and select their data types. Enter names, repeat as needed, and click <em>Save</em></td></tr></tbody></table>

{% hint style="info" %}
To prevent sensitive data from appearing in conversation logs, open the three-dots menu next to a field and turn on the *Sensitive* toggle.
{% endhint %}

{% @arcade/embed flowId="c4sQeYsb7fDJ3mmzAjKm" url="<https://app.arcade.software/share/c4sQeYsb7fDJ3mmzAjKm>" %}

## Action settings

* *Send context*: Provides the context set to the conversation at the time the webhook is called
* *Enable advanced data model*: This is on by default as it allows the use of the schema auto-generation features and additional data structure improvements


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nlx.ai/platform/nlx-platform-guide/flows-and-building-blocks/advanced/actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
