- Permission rules grant permissions to a user based on the returned data, for example premium features for customers on a premium plan.
- Context mappings pass selected fields to your agents, so they can answer with the customer’s plan, account status or order details in mind.
Creating an API Data Source
Navigate to Studio > Data > API Integration to create a new connection. Basic Settings:URL Placeholders
Use the following placeholders in your API URL, headers, or request body:<<email>>- User’s email address<<user_id>>- AGO user ID<<username>>- Username<<api_key>>- Your configured API key<<thread_id>>- ID of the current conversation (empty outside a conversation)<<first_user_message>>- The customer’s first message in the conversation<<user_messages>>- All the customer’s messages in the conversation so far, oldest first, separated by a blank line
<<jwt.claimName>>, including nested paths such as <<jwt.user.id>>. A placeholder occupying the entire JSON value preserves its original type: "<<jwt.userId>>" becomes a JSON number when the JWT claim is numeric.
If the external API requires a string, use "<<jwt.userId|string>>". For example, {"organizationId": "<<jwt.userId|string>>"} sends {"organizationId": "12345"} when userId is the number 12345 in the JWT.
A placeholder with no value, such as a claim missing from the user’s JWT, is sent unchanged. The call still runs, and the conversation’s Full Thread Debug View lists the missing placeholders.
Using the Conversation
The conversation placeholders let an external service answer about the conversation itself, not only about the user. For example, a classifier can tell the agent whether the customer’s request should go straight to a ticket:covered and category) with Include in Conversation enabled, then tell the agent in its instructions what to do with them.
A source that uses a conversation placeholder caches one response per conversation, so a response is never reused in another conversation:
- With
<<first_user_message>>, the service is called once per conversation and the cached response is reused on every later message while the cache is valid. - With
<<user_messages>>, the service is called again after each new customer message. Use it when the first message is often only a greeting.
Answer with a workflow
Instead of calling an external API, a source can be answered by a workflow that runs inside AGO, for example to call your classifier, tag the conversation with its answer (kb_covered or kb_not_covered) and return the answer to the agent. No URL, secret or request template is needed.
- Create a workflow, set Execution to To be used by an agent in its Settings, and publish it. Any trigger works.
- Edit the source, set Answered by to AGO workflow and choose the workflow. Workflows that run in the background or are not published yet are shown but cannot be selected.
Its result becomes the source’s response: Response Data Path, Excluded Response Paths, context mappings and permission rules apply to it as to an API response. The workflow runs with its creator’s permissions and must finish within 20 seconds.
While the cache is valid, the workflow runs once per conversation; disable the cache to run it before every answer. If it fails, the agent answers without this context and the error is shown in the workflow’s Executions; the next message runs it again. The test panel has no conversation, so
thread_id is empty and a Tag conversation block tags nothing. A workflow used by a source cannot be deleted; choose another workflow or switch the source back to its API first. The source keeps its API settings while a workflow answers, so switching back restores them.
Authentication
API Key: Enter your API key in the dedicated field. It is encrypted and stored securely. Reference it in headers using the<<api_key>> placeholder.
Forward User Authentication: Enable this option to send the user’s credentials to the external API, so your API can verify the user’s identity itself. A widget JWT is sent as an Authorization: Bearer header; a widget auth token is sent as an X-Auth-Token header.
HMAC-SHA256 Authentication
Enable Sign requests with HMAC-SHA256 and enter the shared HMAC secret. The secret is stored encrypted and is never returned by the configuration API. When editing a source, leave the secret empty to keep it, or enter a new value to replace it. You do not need to re-enter the secret when changing other settings. Disabling and re-enabling HMAC signing also retains the stored secret. For every outgoing request, AGO generates:X-Timestamp: the current Unix timestamp in seconds.X-Signature: the lowercase hexadecimal HMAC-SHA256 oftimestamp.body, using your secret as a UTF-8 key and the exact request body bytes. For GET requests, the body is empty.
X-Partner-Id, in Request Headers.
For a partner context endpoint, choose POST and configure these headers:
12345 with <<jwt.organizationId>> (or the matching claim path).
Link the source to your agent in the agent settings so its response reaches the conversation. A cached response does not send a new request, so disable caching if you need fresh data on every message. Use the source’s test panel to verify your configuration.
JWT Query Parameters
Map JWT claim values to URL query parameters for user-specific API calls. This allows you to pass information from the user’s authentication token directly as query parameters to the external API. Configuration: Each mapping consists of:- Parameter Name: The query parameter name to add to the URL
- JWT Claim Path: Dot-notation path to the value in the JWT claims (e.g.,
user.department)
department → user.department and a JWT containing:
https://api.example.com/data becomes https://api.example.com/data?department=Engineering.
If a JWT claim is missing or empty, that parameter is silently skipped. This feature requires JWT-authenticated widget users.
Response Configuration
Response Data Path: If your API wraps data in nested objects, specify the path to extract the relevant data using dot notation. For example, if your API returns:data.user to extract just the user object.
Excluded Response Paths: List paths to drop from the response, such as metadata.debug, so that data never reaches your rules or agents.
Caching
Permission Rules
Permission rules define conditions that, when matched against API data, automatically grant specific permissions to users.Creating a Permission Rule
- Navigate to Agents > Permissions > API-based permissions
- Click Add Rule
- Select the API data source and configure the rule name, priority, conditions, and permissions to grant
Conditions
Each condition has a field, operator, and value. All conditions in a rule must match (AND logic).Example
Grant premium permissions to users with an active premium subscription:Context Mappings
Context mappings extract fields from API responses and include them in AI conversations, giving agents relevant business context about users.Field Mapping Configuration
Enable Include in Conversation to share the mapped data with AI agents.
Context Formatting
Included fields appear as a list of labels and values. For example:Testing
Before you link a source to an agent, test it with real user data.- Navigate to Studio > Data > API Integration and open the Test API Data tab
- Select the API data source
- Enter an existing user’s email in User Email, or leave it empty to test with your own user
- For a source that uses a conversation placeholder, type a sample message in Customer message. It is used as the first message and as the whole conversation
- Click Run Test and review the API response, matched rules, and granted permissions
