REST API

Overview

The Webhook connector enables your Leena AI Agents to execute webhooks and interact with external applications through HTTP requests. Webhooks are automated messages sent from one application to another in real time when a specific event occurs.

Unlike traditional APIs that require constant polling to fetch data, webhooks push data to a designated URL endpoint as soon as the event takes place, making them efficient and immediate. The Webhook connector allows Leena AI to trigger workflows, send notifications, synchronize data, and integrate with third-party systems seamlessly.

API Details

Leena AI integrates with webhooks via REST API standards using HTTP protocol with support for multiple HTTP methods and content types.

For more information on webhook standards and REST API best practices, refer to the REST API documentation.

Setup

The Webhook connector uses flexible authentication methods to secure communication with webhook endpoints.

Prerequisites

Before setting up the Webhook connector, ensure you have:

  • Access to the webhook endpoint URL that you want to call
  • Knowledge of the HTTP method required (GET, POST, PUT, DELETE, PATCH)
  • Credentials or authentication tokens if the webhook requires authentication
  • Understanding of the expected request/response format (JSON, XML, or plain text)
  • Access to your Leena AI workspace with connector management permissions
  • Administrator access to configure connector settings

Authentication Methods

The Webhook connector supports multiple authentication protocols:

No Authentication

No authentication is required to execute the webhook. However, users can choose to pass specific keys in custom headers if needed.

Basic Authentication

Basic Authentication uses standard HTTP Basic Authentication. User has to provide:

  • Username: The user account for authentication
  • Password: The account password

These credentials are passed in the Authorization header while executing the webhook.

Bearer Token

Bearer Token authentication requires an authorization token to be provided explicitly. The token is passed in the Authorization header in the format: Authorization: Bearer <token>

Leena App Secret

This authentication method is used to invoke APIs for all internal Leena AI services. User has to provide the Leena App Secret key which is managed within the Leena AI platform.

Get Credentials

The credentials required depend on your webhook endpoint and authentication method:

  • Webhook URL: The endpoint URL where the webhook request will be sent
  • HTTP Method: The HTTP method required by the endpoint (GET, POST, PUT, DELETE, PATCH)
  • Username & Password: For Basic Authentication, obtain these from your service provider
  • Bearer Token: For Bearer Token authentication, retrieve the token from your service provider's API dashboard or authentication portal
  • Leena App Secret: For Leena AI internal services, this is provided during workspace setup

Consult your webhook provider's documentation for specific credential retrieval instructions.

Add Connection

Here is how to add a connection on Leena AI:

  1. Log in to your Leena AI workspace
  2. Navigate to Settings > Integrations
  3. Search for "Webhook" and select it from the list to add a new connector
  4. Start configuring the connector:
    • Webhook URL: Enter the complete URL of the webhook endpoint to be called
    • Authentication Type: Select the appropriate authentication method (No Auth, Basic, Bearer Token, or Leena App Secret)
    • Authentication Credentials: Provide credentials based on the selected authentication method:
      • For Basic Auth: Enter username and password
      • For Bearer Token: Enter the authentication token
      • For Leena App Secret: Enter the app secret key
      • For No Auth: Skip this step (optional)
  5. Test the connection to verify the webhook endpoint is accessible
  6. Save the connector configuration

Actions

The following actions are supported for the Webhook connector:

Execute Web-hook

Executes an HTTP request to a specified webhook URL. The Agent can leverage this action to call external APIs, trigger workflows in other applications, send notifications, synchronize data, or invoke any HTTP-based endpoint.

Description

This action renders the framework to execute a webhook by sending HTTP requests with customizable methods, headers, parameters, and request bodies to any accessible URL endpoint.

Use Cases

  • Event Notifications: Send bot notifications to users with updates on tickets raised in ITSM or other systems
  • Workflow Triggers: Kickstart workflows in one application based on events occurring in another
  • Data Synchronization: Automatically sync data between systems when changes occur
  • Real-Time Alerts: Notify external systems about real-time events like new orders, status updates, or completed tasks
  • Third-Party Integrations: Enable integrations with external systems without requiring periodic API calls
  • Custom Notifications: Push custom messages and data to designated endpoints

Input Parameters

Here are the input parameters required to set up this action:

Mandatory

NameDescriptionExample
URLThe complete URL of the webhook endpoint to be calledbots.leena.ai/integrations/v2/employees
MethodSelect the HTTP method for the webhook callGET, POST, PUT, DELETE, PATCH

Optional

NameDescriptionExample
HeadersCustom HTTP headers to pass in the webhook call. Multiple headers can be added as key-value pairs"email": "[email protected]", "X-Custom-Header": "value"
ParamsQuery parameters to be additionally passed in the webhook call"filter": "active", "limit": "10"
BodyThe request body to be sent with the webhook call. Type can be JSON, plain text, or no bodyJSON object or text string

Sample JSON Input

{
  "url": "https://api.example.com/notifications",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "email": "[email protected]",
    "Authorization": "Bearer token123"
  },
  "body": {
    "ticketId": "TICKET-12345",
    "status": "Resolved",
    "message": "Your ticket has been resolved",
    "priority": "High",
    "assignee": "John Doe"
  }
}
{
  "url": "https://bots.leena.ai/integrations/v2/employees",
  "method": "GET",
  "headers": {
    "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
  },
  "params": {
    "department": "Engineering",
    "status": "active",
    "limit": 20
  }
}
{
  "url": "https://webhook.site/unique-id",
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "X-Custom-Header": "custom-value"
  },
  "body": {
    "eventType": "ticket_update",
    "timestamp": "2025-08-27T10:30:00Z",
    "data": {
      "ticketNumber": "INC0056789",
      "status": "In Progress",
      "updatedBy": "Support Team"
    }
  }
}
{
  "url": "https://api.example.com/sync",
  "method": "PUT",
  "headers": {
    "Authorization": "Basic dXNlcm5hbWU6cGFzc3dvcmQ=",
    "Content-Type": "application/json"
  },
  "body": {
    "userId": "USER123",
    "firstName": "Jane",
    "lastName": "Smith",
    "email": "[email protected]"
  }
}

Response

Upon successful execution, the action returns:

  • HTTP status code indicating success or failure
  • Response headers from the webhook endpoint
  • Response body containing data returned by the webhook
  • Response timestamp
  • Execution duration
  • Any error messages if the webhook call fails

Response Status Codes

Status CodeDescription
200OK - Request succeeded
201Created - Resource successfully created
204No Content - Request succeeded with no content returned
400Bad Request - Invalid request format or parameters
401Unauthorized - Authentication failed or invalid credentials
403Forbidden - Authenticated user lacks permissions
404Not Found - Webhook endpoint does not exist
500Internal Server Error - Server-side error occurred
503Service Unavailable - Server temporarily unavailable

Best Practices

  • Always validate the webhook URL before configuring the connector to ensure it is accessible
  • Use appropriate authentication methods based on your webhook endpoint's security requirements
  • Include meaningful custom headers to identify requests coming from Leena AI
  • Implement error handling in workflows to manage failed webhook executions
  • Test webhook calls with sample data before deploying to production
  • Monitor webhook response times and optimize based on performance requirements
  • Keep authentication credentials secure and never expose them in logs or documentation
  • Use HTTPS endpoints whenever possible to ensure data security
  • Implement request/response logging for troubleshooting and audit purposes
  • Consider rate limiting and timeout settings based on your webhook endpoint's capabilities