Skip to Content

API

The API item feature in Persona Studios’ agenda system allows users to integrate external APIs into their agenda workflows. This enables dynamic data retrieval or submission during conversations, enhancing the persona’s capabilities to interact with external systems seamlessly.

Example Use Cases:

  • Retrieve Data from External API:

    • Obtain a list of available products from Airtable.
    • Access weather information using the OpenWeatherMap API.
    • Scrape data from a user-provided website link.
    • And more…
  • Submit Information:

    • Save a record in Airtable.
    • Submit a ticket to your CRM system after collecting user feedback.
    • Send a notification to a slack channel.
    • And more…

How to Set Up

There are two ways of setup API item:

  1. Using Generate API Configuration: more non-tech user friendly.
  2. Manually input the API specs.

Using Generate API Configuration

Generate API Configuration

  1. Add an API Item: Go to the agenda editor and choose the option to add a new agenda item, then select “API” as the type.
  2. Generate API Configuration: Click the “Generate API Configuration” button and describe your objectives as specifically as possible.
  3. Follow the Instructions: After clicking the “Continue” button, our system will create the appropriate API and guide you in obtaining the necessary information (such as the API key, table name, etc.).
  4. Input the Required Information: Enter the required information and then click “Continue.” All the API details will be automatically filled out in the API interface.

Tips: If you have an API schema that’s publicly viewable, include the URL in your request and your persona will crawl the API schema to pre-fill as many values as it can in the API Configuration.

Manually input the API specs

Manually input the API specs

  1. Add an API Item: Navigate to the agenda editor and select the option to add a new agenda item. Choose the “API” type.
  2. Configure API Details:
    • Use the “Generate API Configuration” button to import an existing cURL command.
    • Enter the API endpoint, headers, and parameters as required.

Authentication

Authentication

We currently support two types of authentication:

  • Bearer Token
  • OAuth 2.0

Authentication can be scoped to either the Agenda Item level or the Persona level:

  • Agenda Item level scope: Choose Inline Authentication. This authentication will only applied to the current agenda item. This is useful if you want to use different authentication for different agenda items.
  • Persona level scope: Choose Use Persona Auth Config. This authentication will be applied to all agenda items under the same persona. This is useful if you want to use the same authentication for all agenda items related to the same persona. To set this up, go to your persona settings under the API Auth Configuration section, then return to the agenda item setup page and select “Use Persona Auth Config” to choose the created auth config.

Persona Level Auth Config

Action after API Call

After the API call, you can:

  • Post-Processing Instructions: Customize the handling of API responses. For example, you want the API response to not contain any ID information, you can use the post-processing instructions to remove the ID field. Simply input: “Remove any field containing id information”
  • Show convey message: Toggle to if you want to show a convey message to the user after the API call. Example:
    • When you call the API to check for product availability, you can show a message to the user to let them know the product is available.
    • If you want to silently submit the conversation info, you can toggle off the “Show convey message” option.
  • Convey Instructions: Specify how to present the API response to the user. For example, the api return a list of available products containing product name, price, and description. You can input: “Show the product name, price, and description to the user”.
  • Scope: Determine data accessibility for subsequent agenda items. For example, If you want to expose availalbe products information to subsequent agenda items, so the AI can have reference to that info and provide option/suggestions to the user.

Advanced Settings

  • Condition Logic: Define conditions under which this item should be triggered. Learn more

Best Practices

  • Test API Calls: Ensure to test the API call before using it in the agenda item using tools like Postman to make sure the API call is working as expected.
  • Secure API Keys: Use the authentication feature to handle authentication and secure the API keys.
  • API response: Refer to limit the size of the API response to make the conversation response faster, and the AI can have more accurate reference to the API response.
Last updated on