Skip to content

External REST API & Webhooks

For advanced transactional business needs, your AI agent requires real-time data from internal systems: warehouse stock counts, courier tracking statuses, appointment availability, or customer subscription tiers.

Pitaj.io API Actions empower the agent to extract structured query parameters from chat messages, trigger outbound REST requests, and formulate helpful conversational responses.


The Outbound Execution Pipeline

[Visitor] "What is the status of my order ORD-8921?"
↓
[AI Agent] Identifies parameter: { "order_id": "ORD-8921" }
↓
[Pitaj.io Backend] Dispatches secure HTTPS request:
URL: https://api.yourbrand.com/v1/orders/ORD-8921/status
Headers: Authorization: Bearer secret_token_xyz
↓
[Your Backend] Returns JSON: { "status": "In Transit", "carrier": "FedEx", "eta": "Tomorrow by 2 PM" }
↓
[AI Agent] Generates response:
"Your order ORD-8921 is currently in transit via FedEx and is scheduled for delivery tomorrow by 2:00 PM!"

Configuring an API Action

  1. Navigate to Actions → + New Action
    Select the REST API Webhook action type.

  2. Define HTTP Method and Endpoint
    Choose the method (GET, POST, PUT) and specify your endpoint URL:
    https://api.yourbrand.com/v1/order-lookup

  3. Set Headers and Authentication
    Supply required authentication headers:

    • Authorization: Bearer your_api_secret_key
    • Content-Type: application/json
  4. Define Extracted Entity Parameters
    List the variables the agent must capture from the customer’s message:

    • order_id (Type: String, Description: The tracking or order number provided by the user)
    • email (Type: Email, Description: The customer’s email address)
  5. Construct Request Body
    Inject dynamic placeholders into the JSON payload (e.g. orderNumber: "{{order_id}}", customerEmail: "{{email}}").

  6. Response Interpretation Prompt
    Instruct the model:
    “Summarize the shipment status clearly, mentioning the courier service and expected delivery window.”

Sample Request Body

{
"orderNumber": "{{order_id}}",
"customerEmail": "{{email}}",
"source": "pitaj_widget"
}

Security Best Practices

Enforced HTTPS

All outbound calls are strictly executed across TLS 1.3 encrypted connections with valid SSL certificates.

Zero Client Exposure

API keys and Bearer tokens are stored in an encrypted server-side vault and are never exposed to browser client inspect tools.