# How to Use HTTP API in ZazzyAgent Flow Builder

Your [ZazzyAgent](http://app.zazzyagent.com) automation can do much more than send predefined messages.

It can also communicate with external systems using an **HTTP API**.

For example, a customer asks:

> Can you check my order?

Instead of replying with a fixed message, your automation can call your order system, receive the current information and use the result in the conversation.

That's the basic purpose of HTTP API integration.

## What is an HTTP API?

An API allows one system to communicate with another system.

In a ZazzyAgent flow, the basic architecture can look like:

```text
Customer
   ↓
ZazzyAgent Flow
   ↓
HTTP API
   ↓
External System
   ↓
API Response
   ↓
ZazzyAgent
   ↓
Customer
```

## What can you use an API for?

Common examples include:

*   Checking order status
    
*   Looking up customer information
    
*   Checking appointment availability
    
*   Retrieving product information
    
*   Sending lead data to a CRM
    
*   Creating a support ticket
    
*   Checking account status
    
*   Retrieving prices
    
*   Connecting custom business software
    

The current API integration supports HTTP methods including GET, POST, PUT and DELETE, along with response mapping back into subscriber/customer fields.

## When should you use an API?

Use an API when ZazzyAgent needs information or an operation that belongs to another system.

For example:

> "What is my order status?"

The information belongs to your ecommerce system.

ZazzyAgent should retrieve it rather than maintain a separate manually updated copy.

## Example: Order lookup

Customer:

> Order 12345 status?

Your flow can:

1.  Capture the order number.
    
2.  Call the order API.
    
3.  Send the order number to the external system.
    
4.  Receive the response.
    
5.  Map the response.
    
6.  Reply to the customer.
    

Example response:

> Your order #12345 is out for delivery.

## Example: Appointment availability

Customer:

> Can I book tomorrow?

Your automation can call:

**Booking API**

and retrieve available slots.

For example:

```text
API Response

10:00 AM
1:00 PM
4:30 PM
```

The available options can then be presented to the customer.

## Create an HTTP API integration

Open the HTTP API/integration area in ZazzyAgent.

Create a new API configuration.

Give it a meaningful name.

For example:

> Check Appointment Availability

rather than:

> API 1

## Choose the HTTP method

Depending on what your external system expects, choose the appropriate method:

**GET**

Usually used to retrieve data.

**POST**

Usually used to send information or create something.

**PUT**

Usually used to update information.

**DELETE**

Used to delete information where your external system supports that operation.

The API must be configured according to the requirements of the external service.

## Enter the endpoint

Provide the API endpoint.

For example:

```text
https://api.example.com/orders
```

Use the actual endpoint supplied by your system.

## Add authentication

Your API may require authentication.

Examples include:

*   API key
    
*   Bearer token
    
*   Other supported authentication methods
    

Store credentials using the secure configuration available in ZazzyAgent rather than putting secrets into customer-facing messages.

## Add request parameters

Suppose your endpoint expects:

```text
order_id
12345
```

Your Flow can pass the customer's captured order number as the request value.

This lets the same API configuration work for different customers.

## Use dynamic customer data

API requests become much more useful when the request can use information collected earlier in the flow.

Example:

```text
User Input
   ↓
Save Order Number
   ↓
HTTP API
   ↓
Use Order Number
```

Now each customer can retrieve their own information.

## Example: Lead submission

Suppose a website or chatbot collects:

*   Name
    
*   Email
    
*   Phone
    
*   Requirement
    

An HTTP API can send this information to your CRM.

The flow becomes:

```text
Customer
   ↓
User Input
   ↓
Save Fields
   ↓
HTTP API
   ↓
CRM
```

## Read the API response

Calling the API is only half the process.

You also need to understand the response.

For example:

```json
{
  "status": "shipped",
  "tracking_number": "TRK12345"
}
```

You might want to use:

**status**

and:

**tracking\_number**

in the next step of your flow.

## Response Mapping

Response mapping lets you map returned API data into the appropriate customer/subscriber fields.

Our current API functionality supports syncing returned response data into subscriber fields through response mapping.

For example:

```text
API status
    ↓
Order Status custom field
```

## Show API data to the customer

Suppose your API returns:

```text
name = Rahul
status = Shipped
date = September 10
```

Your next message can use the mapped information.

For example:

> Hi Rahul. Your order is shipped and is expected on September 10.

## Use an API in a condition

You can combine API results with Flow Builder conditions.

For example:

```text
API
 ↓
Appointment Available?
 ↓
YES → Show booking options
NO  → Ask customer to choose another date
```

This creates genuinely dynamic automation.

## API errors

Your workflow needs to account for failures.

Possible problems include:

*   Invalid API URL
    
*   Authentication failure
    
*   Timeout
    
*   Invalid request
    
*   External server error
    
*   Unexpected response
    
*   Missing data
    

Don't build a workflow that assumes every API call will succeed.

## Test the API before using it in a flow

The current API integration workflow verifies the API configuration before allowing the integration to be saved.

Test:

*   Request
    
*   Authentication
    
*   Parameters
    
*   Response
    
*   Response fields
    

before connecting it to a customer-facing flow.

## API and Flow Builder

A typical API-powered automation looks like:

```text
Trigger
   ↓
Collect Input
   ↓
HTTP API
   ↓
Response
   ↓
Condition
   ↓
Customer Reply
```

This is one of the most powerful patterns available in Flow Builder.

## API vs Webhook

These are related but different.

### HTTP API

ZazzyAgent actively calls another system.

### Webhook

Another system sends information to ZazzyAgent.

Think:

> **API = ZazzyAgent asks.**

> **Webhook = another system tells ZazzyAgent.**

See [What Is a Webhook in ZazzyAgent?](https://blog.zazzyagent.com/what-is-a-webhook-zazzyagent).

## API vs Google Sheets

Google Sheets can be useful for simple structured data.

An API is usually better when you need real-time communication with another application.

For example:

**Simple internal data**

→ Google Sheets

**Live booking system**

→ API

## API security

Never expose private API credentials in:

*   Customer messages
    
*   Public URLs
    
*   System Prompt text intended for customers
    
*   Flow messages
    

Use the secure API configuration available in the platform.

## Best practices

Keep APIs focused.

For example:

> Check Order Status

is better than an undocumented endpoint that does ten unrelated things.

Make the expected request and response structure clear.

Also design a fallback response for errors.

## A complete example

Customer:

> I want to know my appointment availability.

Flow:

**Ask date**

↓

**Save date**

↓

**Call HTTP API**

↓

API returns:

```text
10:00
13:00
16:30
```

↓

Show available options

↓

Customer selects one

↓

Continue booking.

That's the difference between a static chatbot and an automation connected to live business data.
