How to Create a Custom Action


Custom Actions in Synthflow AI

Custom actions allow users to integrate external APIs or services into the Synthflow AI platform. This feature enables you to extend the functionality of your voice assistant by making API calls, manipulating data, and performing specific tasks during or before a call.


Step-by-Step Breakdown of Custom Action Configuration

1. Connect to the API

In this section, you build the API call for the custom action by defining the following:

  • Method: Choose the HTTP method for your API call (e.g., GET, POST, PUT, PATCH).
  • URL: The API endpoint where the request is made. For example, a POST request to https://api.example.com/v1/user/profile.

Subsections within Connect to the API:

  • Body: Define the request body that will be sent. To reference variables, first create them in the next section, then insert them using <> within the body.
  • Headers: Add key-value pairs for any headers required by the API, such as Content-Type: application/json.
  • Authentication: If your API requires authentication (e.g., a token), toggle the Authorization needed option to add authentication details.

2. Variables

Variables are placeholders that the custom action can fill with data before or during the call. You can define two types of variables:

  • Before the Call: These variables are set before the call starts. For example, you can use {user_phone_number}, which gets replaced by the caller's phone number.
  • During the Call: These are variables the AI will ask the user to provide in the middle of the call. You can add a name, specify the variable type (e.g., string, int, phone_number), and provide an example for reference.

3. Set Up Your Action Details

This section lets you define what the custom action does. The following fields are required:

  • Name: The name of the custom action (e.g., “Fetch User Profile”).

🚧

The name is highly important for the AI to understand what the Action does and when to use it. Keep it simple and actionable.

  • Description: A short description of what this action is meant to do (e.g., “Call this API to retrieve the user's profile details”).
  • Speech: Define what the AI assistant will say while the action is running.

You can also choose to run this action before the call starts by toggling the provided switch.


4. Write a Prompt to Use Action Results

Once you have set up the custom action, you can write a prompt to incorporate the results of the action into the conversation. This prompt will be added to the assistant’s script and will allow the AI to respond based on the data retrieved or actions performed by the custom action.


Key Benefits of Custom Actions

  • Extend Assistant Capabilities: By integrating external APIs, you can provide the assistant with real-time data and functionality (e.g., retrieving customer data or making calculations).
  • Dynamic Conversation Flow: Using variables and API results, you can adjust the conversation dynamically based on user input or other external factors.
  • Custom Workflows: Custom actions enable you to create complex workflows involving third-party services, giving you full control over how calls are handled.

Synthflow AI’s custom actions provide a robust framework for integrating external data sources and services, giving you the flexibility to extend your assistant’s functionality according to your business needs.