Skip to main content

Overview

API integration allows your voice agents to interact with external systems, fetch data, and perform actions beyond conversation. Hamsa’s tool system makes it easy to connect to any HTTP API, enabling powerful workflows like looking up customer data, creating tickets, sending notifications, and more.
What You Can Do with API Integration:
  • Look up customer information from your CRM
  • Create and update tickets in your helpdesk
  • Check inventory and availability
  • Process orders and payments
  • Send emails, SMS, and notifications
  • Update databases and systems
  • Verify account credentials
  • Access any HTTP/REST API

Tool System Basics

What Are Tools?

Tools are reusable API configurations that your agents can call during conversations. Think of them as functions your agent can execute. Tool Components:
  • Name & Description - What the tool does
  • HTTP Method - GET, POST, PUT, DELETE, PATCH
  • URL - API endpoint (supports path parameters)
  • Authentication - API keys, bearer tokens
  • Headers - Custom HTTP headers
  • Parameters - JSON schema defining inputs
  • Messages - What agent says during execution

Creating Your First Tool

Let’s create a tool to look up customer information.
1

Navigate to Tools

Go to Tools in the sidebar and click Add New Tool
2

Configure Basic Info

3

Configure Tool Settings

4

Define Parameters

5

Set Messages (Optional)

6

Save Tool

Click Save Tool to create the reusable tool template

Using Tools in Agents

In Flow Agents

Add tools to your conversation flow using Tool Nodes. Example: Customer Lookup Flow
Tool Node Configuration:

In Single Prompt Agents

Add tools to configuration, agent decides when to call them.
1

Open Agent Configuration

Navigate to your Single Prompt Agent settings
2

Add Tools

Go to ConfigurationToolsAdd Tool
3

Select Tools

Choose tools from your library
4

Configure Overrides (Optional)

Override parameters or headers for this specific agent
5

Update Prompt

Mention tools in your preamble:

API Patterns

GET Requests - Retrieving Data

Fetch information from your systems. Example: Get Order Status
Response Handling:

POST Requests - Creating Data

Create new records in your systems. Example: Create Support Ticket
Usage in Flow:

PUT/PATCH Requests - Updating Data

Modify existing records. Example: Update Customer Preferences

DELETE Requests - Removing Data

Delete records (use with caution). Example: Cancel Appointment

Advanced Patterns

Chained API Calls

Call multiple APIs in sequence. Example: Order Fulfillment Chain

Conditional Tool Execution

Execute tools based on conditions.

Error Handling & Retries

Handle API failures gracefully.

Async Tool Execution

For long-running operations.
With async enabled:

Authentication Methods

Bearer Token (JWT)

Most common for modern APIs.
Headers sent:

API Key in Header

Common for older APIs.

No Authentication

For public APIs.

Custom Authentication

Use headers for custom schemes.

Parameter Schemas

Basic Types

String Parameter:
Number Parameter:
Boolean Parameter:
Enum Parameter:

Complex Types

Object Parameter:
Array Parameter:

Using Variables in Parameters

Map conversation variables to API parameters.

Path Parameters

Use dynamic URL segments. URL Template:
Configuration:
Usage in Flow:

Response Handling

Using API Responses

Tool responses become available as variables. API Response:
Available Variables:
Using in Conversation:

Response Validation

Check API responses before using.

Complete Integration Examples

Example 1: CRM Customer Lookup & Update

Example 2: E-commerce Order Management

Example 3: Appointment Scheduling System

Troubleshooting

Check:
  • Tool description is clear about when to use it
  • Tool is added to agent configuration
  • Agent prompt mentions the tool
  • Conversation provides context for tool use
Solutions:
  • Improve tool description
  • Add explicit examples to prompt
  • Mention tool capabilities in greeting
Check:
  • URL is correct and accessible
  • Authentication credentials are valid
  • Required parameters are provided
  • Headers are correctly formatted
  • Firewall/network allows requests
Debug:
  • Test API with curl or Postman
  • Check API response in call logs
  • Verify parameter values in logs
  • Check for CORS issues
Check:
  • Variable names match exactly
  • Variables are populated before tool call
  • Parameter schema is correct
  • Data types match expectations
Solutions:
  • Verify variable extraction works
  • Check variable values in call logs
  • Add validation before tool call
  • Use correct variable syntax: {{variable_name}}
Check:
  • API response time
  • Timeout setting in tool config
  • Network latency
Solutions:
  • Increase timeout value
  • Optimize API performance
  • Use async mode for slow operations
  • Add retry logic

Next Steps

Tools Documentation

Complete guide to the tool system

Data Collection

Collect data to pass to APIs

Webhooks

Receive events from Hamsa

Variables

Use variables in tool parameters