Custom API

Open in CMS

The Custom API screen defines the HTTP APIs your agent can call during a conversation, for example to look up an order or create a ticket. Found in the agent sidebar under Tools → Custom API. Changes you make here are kept on the page until you click Save all changes.

Custom API

Search APIsNarrows the list to the APIs that match your search.
More actionsA menu with Categories, Set authentication and Import OpenAPI schema.
Add APIOpens the New API panel.
Empty state"No APIs yet" is shown when there are no APIs. It has an Import OpenAPI schema button and an Add API button.
Save all changesSaves every API and category change after you confirm.

More actions

CategoriesOpens the Categories dialog to add, rename and delete categories.
Set authenticationOpens the Set authentication panel to apply one authentication to many APIs at once. Disabled when there are no APIs.
Import OpenAPI schemaOpens the import window to create APIs from an OpenAPI schema.

API List

Column headersClick a header to sort the list. APIs are sorted by name inside each category.
Group headerOne for each category, and one for Uncategorized, which holds APIs without a category. Click it to collapse or expand the group. A group with no APIs says "No APIs here yet."
API rowShows the API name and description. Click it to open the Edit API panel.
On switchTurns an API on or off for the agent without deleting it.
Row menuEdit API and Remove API.
Remove APIRemoves the API from the list straight away, with no confirmation. Nothing is saved until you click Save all changes. Cancel brings it back.

Categories

New category nameEnter a name and click Add category. A name that already exists cannot be added.
RenameRenames the category.
DeleteDeletes the category. Disabled while the category still holds APIs. Move the APIs out first.
DoneCloses the dialog.

New API / Edit API: Basic Information

Action nameA unique, descriptive name for the API (required), for example retrieve_weather_data.
CategoryOptional. Groups the API in the list. The agent does not use it. Shown only when categories exist.
DescriptionExplains in detail what the API does. The agent uses it to decide when to call the API.
HTTP methodGET, POST, PUT, DELETE or PATCH (required).
Target URIThe endpoint the API call goes to (required).
Loading text typeWhat users see while the API runs: None, Fixed, Dynamic or Auto.
Loading text / Loading text promptShown for Fixed (the exact text to display, as Loading text) and Dynamic (a prompt the agent uses to write the text, as Loading text prompt).
RulesHow to format the result and what to do with the data next.
Response promptHow the agent should present the result.
Accept extra parametersLets the agent send parameters that are not in the parameters list.
Send conversation detailsSends agent, user, message and channel details with each request, as headers and, depending on the HTTP method, in the query string or request body.

New API / Edit API: Authentication

Authentication typeNone, Basic, Bearer, Custom or Oauth.
TokenBearer: the bearer token the API gives you.
Username / PasswordBasic authentication credentials.
Header nameCustom: the name of the header that carries the key, for example X-API-Key.
KeyCustom: the value sent in that header.
OAuth providerClient credentials or Google service account (JWT bearer).
Token URLThe address that issues access tokens.
Client ID / Client secret / ScopesClient credentials settings.
Google service account JSONGoogle service account: upload the JSON key file from Google Cloud Console. On an existing API, a new file replaces the saved one.
User to act as / API scopesGoogle service account: the user to impersonate (optional, needed for Gmail APIs) and the Google API scopes to request.

New API / Edit API: Parameters

NameThe parameter name (required).
TypeBoolean, Number or String (required).
LocationWhere the value is sent: Querystring, Header, Body or Path (required).
RequiredMarks the parameter as required. The agent must fill it in every time.
Allowed valuesOptional. Limits the parameter to these values. Type a value and press Enter. Leave empty to allow any.
DescriptionTells the agent what to put in the parameter.
Add parameterAdds another parameter. The trash icon removes one.
Apply / Add APIApplies the panel to the list. Click Save all changes afterwards to save it.
Test APIShown when editing an existing API. Opens the test view. It is disabled while the form has changes you have not applied.

Test API

Back to editingReturns to the API form.
APIThe HTTP method, authentication, endpoint and description of the API.
ParametersAn input for each configured parameter.
Conversation detailsShown when Send conversation details is on: Agent ID, User ID, User email, Message ID, Media type, Messenger product and Messenger account code, sent with the request.
Call APISends the request.
ResponseThe status code and Body. Response headers opens the headers.

Import OpenAPI Schema

The import window has four steps: Upload, Edit, Review and Done.

Schema formatJSON or YAML (required).
Schema fileDrop a JSON or YAML file on the drop zone, or click it to select one.
AuthenticationKeep what each API has now, or none for a new API keeps the existing authentication. Use the same authentication for every imported API applies the fields you enter here to all imported APIs.
OpenAPI schemaThe schema editor (Edit step). Fix anything the import should not read, or paste a schema in place of the file.
What the import changesThe Review step. A table of the APIs with a Change of New or Replaced. A replaced API takes the description, method, endpoint and parameters from the schema. Its rules, response prompt, loading text and authentication stay.
Import N APIsAdds the APIs to the list. Nothing is saved until you save the page.
Import completeThe Done step. Shows how many APIs were imported. Check their authentication, then save the page.

Set Authentication

Authentication fieldsThe same fields as the Authentication section of an API.
Search APIsNarrows the list of APIs.
APIs to updateAll APIs grouped by category, with checkboxes. The header shows "N of M selected", with Select all and Clear all.
Apply to N APIsAsks you to confirm Replace authentication?, then overwrites the authentication of the selected APIs. The page is saved at once, and the confirmation says that every other change on the page is saved too.
CancelCloses the panel without changes.

Related guide: Connect Your API