Create Actions: use advanced options to build custom Actions for AI AgentUpdated 21 days ago
You can use a visual workflow builder to create custom Actions for AI Agent that align with your brand’s unique business needs and use cases.
When you create an Action for AI Agent, select Advanced options to open a visual workflow builder. Brands that have the technical knowledge can use the visual editor to connect AI Agent with 3rd-party apps (using HTTP requests), and use conditional logic and variables to create different resolutions paths for an Action.
What you’ll need to get started
- You must have familiarity with making HTTP requests to use Advanced options
- You must have an active Automate subscription
- You must have Lead or Admin permissions to create Actions
- You must have AI Agent enabled on Email (currently Agent cannot perform Actions on Chat).
Enable the advanced Action editor
Whenever you create a new Action, you can choose to use the advanced editor. You can also convert an existing Action to use the advanced editor.
Keep in mind — if you enable the advanced editor (for a new or existing Action), you cannot return to using the basic editor to make changes to the Action.
- From the main menu, go to Automate
- Select your store from the sidebar, then click on AI Agent
- In the Actions tab, select Create Custom Action
- Enter a name and description, then set conditions for AI Agent to use the Action
- Learn more about names and descriptions, conditions
- You can also decide whether to require customer confirmation
- To use the advanced editor, select Advanced options
- Select Convert to Advanced View to confirm
- Select Edit to open the canvas for the advanced editor
Using the advanced editor to build an Action
Once you enable the advanced editor, you can use the visual workflow builder to create a custom Action for AI Agent.
Collect information from shoppers (optional)
AI Agent can collect information from shoppers before performing an Action. The information that you collect can be used as variables to create different resolution paths for your shoppers.
For example, you may want to create an Action to provide shoppers with a refund when there’s an issue with their order. However, sometimes you may also reship the order based on the shopper’s contact reason.
At the beginning of your Action’s flow, use Collect information to tell AI Agent what information to gather from the shopper. Before the Action is performed, AI Agent will naturally and conversationally ask the shopper for these details.
- Select Collection information at the beginning of the Action’s workflow
- Select + Add Variable
- Choose a data type, then enter a Variable name and description
- Using the example above, your variable name might be “replacement reason”. In the description, tell AI Agent: “categorize the replacement reason into one of the following categories: damaged, exception, lost in transit”
- AI Agent can interpret customer responses to sort the replacement reason as either damaged, exception, or lost in transit
- Any information AI Agent collects can then be used as variables in subsequent Action steps, including HTTP requests and Conditions.
Here are descriptions for each of the data types you can collect as variables:
Data type | Definition | Example |
String | Anything text contains letters or a combination of letters and numbers | An address, a cancellation reasons |
Boolean | True/false or yes/no questions | Answers questions like:
|
Number | Any input that contains only numbers | Ask about item quantity |
Date | A date in any format | Asking for a new delivery date |
Adding steps to your Action
On the visual canvas, you can add one or more steps to your Action.
Each step connects to a different app where AI Agent needs to perform a task to complete your Action. You can select from apps that Gorgias already has an existing integration with, or use a custom HTTP request to connect with another 3rd-party app.
- Use the + button to add a new step
- Select an app that AI Agent needs to complete the Action
- When you select an app, an alert ⚠️ appears beside steps that require additional set up from you
- If an app requires you to authenticate → select the step to add your API key.
- If you need help, use the link on How to find your API key. Learn more about connecting AI Agent to your apps.
- If an app requires additional values → select the step, then add the mandatory information
- For example, if you add a step to send a Shopify discount code, you will need to select the discount amount, when the discount expires, and so on.
- If an app requires you to authenticate → select the step to add your API key.
- If you need to connect to an app that is not listed, select HTTP request
Making custom HTTP requests
An HTTP request allows you to connect AI Agent to apps that Gorgias has not already built an integration with.
To successfully set up an HTTP request, we recommend that you review the developer documentation for the app you want to communicate with.
- On the visual canvas, select the + button to add a step
- Select HTTP request
- Enter the details of the request:
- Give the step with your HTTP request a name
- Enter the endpoint URL for the application where you want to make the request
- Choose your HTTP method (GET, POST, PUT, DELETE, PATCH)
- Set up your request’s headers using key-value pairs
- Use {+} to add variables to the URL, header or body of your request. You can use variables from:
- Any information you collect from the shopper at the beginning of the Action’s flow
- Output from an app or HTTP request used in a previous step
- Information from Shopify about the Customer or the Order
- Select Test Request to try out your request and fix any errors
- Under Output variables you can select data from the HTTP response to create variables that can be used in subsequent Action steps, including conditions and other HTTP requests.
- Select + Add Variable, then enter a variable name for the data you want to use
- Use JSONpath notation to select the data you want from the HTTP response (for example
$.address.city
)
- Optionally, under Results explanation for AI Agent you can add context about the data you want to use as a variable
- For example, data from the HTTP response called
$.message
may actually refer to an order status. You can add a description for AI Agent so that its use of the variable is more accurate. - Select + Add Output, then enter a description of the variable for AI Agent
- For example, data from the HTTP response called
Conditional steps and variables
Conditional steps add branches to your Action’s workflow. You can use conditions to give shoppers a different resolution path based on a set of variables.
Variables you can use include:
- information you collect from the shopper at the beginning of the Action
- output from an app or HTTP request used in a previous step
- information from Shopify about the Customer or the Order
For example, you may want to create an Action so that AI Agent can process returns, but you only accept returns in the United States. You can use a conditional step that checks for the variable Shipping address country
from the shopper's order before AI Agent sends a link to your return portal.
- On the visual canvas select the + button to add a step, then select Conditions
- Configure each branch in your conditional step:
- Give each branch a name
- Choose what level of conditions must be met for AI Agent to proceed with the branch: All conditions are met or At least 1 condition met
- Open the Add Condition dropdown menu to select one or more variables as your conditions
- Select + Add Branch to add another branch
Test your Action
When you finish setting up your Action, you can test how it works in the AI Agent test environment. Select Create and Test to go to the test environment directly from the Action editor.
The test environment is a controlled space where you can simulate real interactions with shoppers — including asking questions about orders or imitating Actions. When used in the test environment, Actions do not make any changes in your connected apps.
Troubleshooting Action errors
If AI Agent encounters an error with your set up, it may be unable to fully complete all the steps in your Action.
In these cases, AI Agent adds a note in the ticket conversation to indicate that it failed to perform one or more Action steps and handed over the ticket to your team. You can use the link in the note to go to the Action’s event log. Look for entries with an error
status to investigate.