Actions

custom action

Connect your API to Muchat, define inputs, and control which response data the agent can access.

Overview

A custom action calls an API from the server and lets Muchat use its response in the conversation. Use it to retrieve current information, look up records in your systems, or perform a task through an API.

Best for

Tasks available through an API, such as retrieving weather, checking a request’s status, or updating a subscription in your system.

How to create the action

Create an action

In Actions, select Create action, then custom action.

Write the general settings

Enter the name and trigger description, then select Save and continue.

Choose the action type

Select the API call option in Action type, then continue.

Configure inputs and the request

In API, define the information needed and how to send it. See API below.

Test the response

In Test response, run a live request or enter example JSON. Then configure which response fields Muchat can access in Data access.

Save and enable

Select Create action, check its status in My Actions, and test a matching request in the Playground.

General

Action name: Choose a name that describes the task, such as Get_Weather.

When to use: Explain what the action returns, which requests should trigger it, and what Muchat should ask if information is missing. For example: “Use this action when a customer asks for the current weather in a city. If the city is missing, ask which city first.”

Get_Weather name and instructions to ask for the city when it is missing
The action name and specific trigger instructions for the weather example

API

Collect data inputs

Muchat extracts inputs from the conversation and asks the customer when needed. Each input becomes a variable in the API request.

SettingPurpose
NameVariable name, such as city or request_id, for use in the request template
TypeText (string), numeric (number), logical (boolean), or structured (object) data
DescriptionThe input’s meaning and expected format, helping Muchat ask the right question
RequiredWhether the action needs this input to run
ArrayWhether the input is a list of values of that type

Input names must be unique. Use English letters, digits, and underscores for variable names, starting with a letter. Leave the input list empty if the API has no variable inputs.

A city input with a description, string type, and required enabled
The city input is a string and must be provided for this action to run.

API request

Choose GET, POST, PUT, PATCH, or DELETE and enter the complete API URL. Use double-brace variables, such as {{city}}, in request values:

SectionExample and purpose
URLA variable in the path, such as https://api.example.com/requests/{{request_id}}
ParametersQuery string key-value pairs, such as city with value {{city}}
HeadersAPI headers such as Authorization or Accept
BodyJSON data for methods that accept a body
Weather API request with the city variable and format parameter
The city variable appears in the URL, with format set to j1 in the parameters.

Type a variable directly using double braces, or select a defined input with add variable. Query string values entered in the URL are added to the parameters table automatically.

Define every variable you reference in the input list. Avoid using an optional input that may be absent in a mandatory URL or header value: a missing value for a referenced variable prevents the request from being prepared.

Do not send a body with GET. For other methods, provide valid JSON. When a field’s entire value is a variable, its original type is preserved. In this body, quantity can remain a number and enabled a boolean:

JSON body using defined inputs
{
  "quantity": "{{quantity}}",
  "enabled": "{{enabled}}"
}

Define quantity as number and enabled as boolean for this example. Object and array inputs must also occupy an entire field value; do not embed them in text or URLs. Quotes and line breaks inside text are encoded correctly when the JSON request is built.

Test response

  • Live response: Select live, supply test input values, and select Test response. Check the HTTP status and returned JSON. This is a real request and can change service data.
  • Example response: Enter JSON manually to define the response structure and prepare field selection. Real conversations still call the API.

The response must be JSON with an object or array at its root. HTML, plain text, and empty responses are unsuitable. After changing the URL, inputs, or response structure, repeat the test and review allowed fields.

A real weather API JSON response with HTTP 200 status and the Next step button
Test Get_Weather with city set to London, then continue after a successful response.

Data access

OptionBehavior
Full data accessMuchat receives the complete API response.
Limit data accessMuchat receives only selected response fields. Select at least one.

For example, if an API returns internal notes alongside status and tracking_url, select only the fields needed for the customer’s answer. The table lists top-level response fields. Selecting an object or array also exposes all its children. To share only part of that content, adjust your API response to return the needed data in a separate field.

Limited data access with only current_condition selected from the four weather response fields
Only current_condition is selected; Muchat cannot access the other three weather response fields.

Response access controls do not replace authentication and authorization in your API. Check that the customer is allowed to view or change the requested record. Configure service credentials in headers rather than asking customers to supply them as inputs.

Examples

Weather lookup

Create Get_Weather with one required string input named city, described as “The city whose weather the customer is asking about.” Choose GET and enter:

Request URL
https://wttr.in/{{city}}?format=j1
Enter the URL, select the city variable, and automatically populate the format parameter

No body is needed. Test the live response with London as city and select Test response.

Run a live test with London and receive a successful JSON response

After receiving the response, choose limit data access and select only current_condition. It contains current weather information, including temp_C, FeelsLikeC, and weatherDesc. Leave nearest_area, request, and weather unselected to avoid sending extra information and the multi-day forecast to Muchat.

In the Playground, ask “What is the weather in London right now?” Check that the action receives the correct input and the reply uses the returned data. Asking only “What is the weather?” should make Muchat ask which city.

Update a subscription through your API

If your service has a subscription update API, create Update_Subscription with required string inputs named subscription_id and plan. Describe that it should only update a subscription after the subscription and requested plan have been identified.

For an API with the following contract, choose PATCH and replace the address with your own API:

Request URL
https://api.example.com/subscriptions/{{subscription_id}}
Request body
{
  "plan": "{{plan}}"
}

Add the service’s authentication header. Use a test subscription and a valid plan from that service. A successful API response could have this structure:

Example structure for your API response
{
  "subscription_id": "sub_123",
  "plan": "premium",
  "status": "active"
}

Expose the necessary response fields and check the result both in the conversation and in your subscription system. A success message should follow an actual successful API update.

Limits

  • Requests have a maximum execution time of 30 seconds.
  • The raw API response must not exceed 1 MiB. After access filtering, the data passed to Muchat must not exceed 20 KiB. Select fewer fields for large responses.
  • Responses must have a successful HTTP 2xx status. Redirects are not followed automatically; enter the final API URL.
  • Limited access requires an object at the JSON response root. Wrap a root array in an object in your API, or use full access within the size limit.

Troubleshooting

MuChat documentation

On this page