Skip to main content

Command Palette

Search for a command to run...

How to Configure an HTTP API Request Body in ZazzyAgent

Updated
View as Markdown

Some APIs need information sent inside the request itself.

This information is called the request body.

For example, when sending a new lead to a CRM, the API may expect:

{
  "name": "Rahul",
  "email": "rahul@example.com",
  "phone": "+919999999999"
}

ZazzyAgent can use information collected during a conversation as part of an API request.

When is a request body needed?

A request body is commonly used with APIs that create or update information.

Examples:

  • Create a lead

  • Submit a booking

  • Create a support ticket

  • Update customer information

  • Send an enquiry

  • Create an order-related record

A GET request will often rely on URL parameters instead, while POST and PUT requests commonly use request body data. The external API documentation determines the exact requirement.

Request body vs parameters

These are different.

URL or query parameter

/orders?order_id=12345

Request body

{
  "order_id": "12345"
}

The API documentation tells you which format it expects.

Sending the correct value in the wrong location can result in an error.

Prepare the data before the API call

A good flow usually collects and saves the required information first.

For example:

Customer
   ↓
User Input
   ↓
Name
Email
Phone
Requirement
   ↓
HTTP API
   ↓
CRM

This allows the same API configuration to work for different customers.

Create the API integration

Open the HTTP API integration area in ZazzyAgent.

Create a new integration or open an existing one.

Choose the HTTP method required by the external API.

Enter the endpoint.

Then configure the request data or body according to the API's specification.

Static vs dynamic values

Request-body fields can contain information that stays the same or information that changes for every customer.

Static value

Example:

{
  "source": "ZazzyAgent"
}

Every API request sends the same value.

Dynamic value

Example:

{
  "name": "#LEAD_USER_FIRST_NAME#"
}

The value comes from customer data available to the automation.

Dynamic values are what make one API configuration usable across many conversations.

Example: Lead submission

Suppose your automation collects:

Name
Email
Phone
Requirement

The receiving CRM expects:

{
  "name": "Rahul",
  "email": "rahul@example.com",
  "phone": "+919999999999",
  "requirement": "Website redesign"
}

The flow can collect those values and send them through the API.

The important part is that the names and structure match what the external API expects.

Match the API's field names

Suppose the API requires:

{
  "first_name": "Rahul"
}

Do not assume this is equivalent to:

{
  "name": "Rahul"
}

The external system may expect one specific field name.

Always check the API documentation.

Nested JSON data

Some APIs require nested objects.

For example:

{
  "customer": {
    "name": "Rahul",
    "email": "rahul@example.com"
  }
}

Others may require:

{
  "customer_name": "Rahul",
  "customer_email": "rahul@example.com"
}

These structures are not interchangeable.

Understand the expected JSON structure before configuring the integration.

Sending numbers and text

The API may distinguish between:

{
  "quantity": 5
}

and:

{
  "quantity": "5"
}

One is a number.

The other is text.

Follow the data type required by the API.

The same principle applies to:

  • Boolean values

  • Dates

  • Arrays

  • Objects

  • Numbers

  • Text

Example: Booking request

Imagine your flow collects:

Customer Name
Service
Date
Time

The booking API may require:

{
  "customer_name": "Rahul",
  "service": "Dental Cleaning",
  "date": "2026-09-25",
  "time": "15:00"
}

The automation becomes:

Collect booking details
        ↓
Save customer input
        ↓
HTTP API
        ↓
Booking system
        ↓
Confirmation

Validate data before calling the API

Don't send incomplete information when the API requires mandatory fields.

For example:

Customer provides phone
        ↓
Email missing?
     ↙       ↘
   Yes        No
   ↓           ↓
Ask email    Call API

Using conditions before the API call can prevent unnecessary failed requests.

See How to Use Conditions in ZazzyAgent Flow Builder for conditional routing.

Handle special characters carefully

Customer input can contain:

  • Apostrophes

  • Quotes

  • Line breaks

  • Emojis

  • Symbols

  • Multiple languages

Your API integration should send data in the format expected by the receiving system.

Always test with realistic customer input rather than only simple words.

Don't expose internal request data

The customer does not need to see the technical request.

Avoid sending something like:

{
  "customer_id": "12345",
  "internal_source": "zazzyagent",
  "api_key": "..."
}

in a customer-facing reply.

The API request and the customer message are separate parts of the automation.

How to troubleshoot request-body errors

400 Bad Request

Check:

  • Field names

  • Required fields

  • JSON structure

  • Data types

  • Missing values

401 or 403

Check authentication and headers.

404

Check the endpoint URL.

API accepts request but does the wrong thing

Compare the body with the external API's required schema.

A field mapped to the wrong property can produce unexpected results even when the request technically succeeds.

Test with real values

Don't test only:

Name = Test
Phone = 123
Email = test@test.com

Also test:

Name = Rahul O'Brien

and realistic phone numbers, long requirements, optional fields, and missing information.

The goal is to verify that your automation works with actual customer data.

A practical request architecture

Customer
   ↓
User Input
   ↓
Save Data
   ↓
Validate Data
   ↓
HTTP API
   ↓
Request Body
   ↓
External System
   ↓
API Response
   ↓
Next Flow Step

This pattern works for CRM submissions, booking requests, ticket creation, lead capture, and many other integrations.

For the broader setup, see HTTP API in ZazzyAgent: Complete Guide to External API Automation.

For response handling, see How to Use API Response Data in ZazzyAgent.

Best practice

Treat the request body as a contract between ZazzyAgent and the external application.

Before publishing the automation, verify:

Field name
Field value
Data type
JSON structure
Required fields

A correctly configured request body is what allows your flow to pass useful customer information into another system.