> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adsera.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Send an Agent Event

> Tells the Meta AI Agent on your number about something that happened in your systems (an order shipped, a payment received…), so it can tell the customer in the chat. Requires the Meta AI Agent to be enabled for your account and set up on the number.



## OpenAPI

````yaml POST /api/pub/wa/business-agent/events
openapi: 3.1.0
info:
  title: AdsEra REST API
  description: >-
    Welcome to the AdsEra REST API. Use our API to integrate powerful,
    multi-channel communication (Email and WhatsApp) directly into your
    applications. Automate transactional messages, trigger marketing campaigns,
    manage your audience, and track performance programmatically.
  contact:
    name: Shubham
    email: shubham@adsera.in
  version: 1.0.0
servers:
  - url: https://app.adsera.in
    description: Production Server
security:
  - AppIdAuth: []
    AppSecretAuth: []
paths:
  /api/pub/wa/business-agent/events:
    post:
      tags:
        - Meta AI Agent
      summary: Send an Agent Event
      description: >-
        Tells the Meta AI Agent on your number about something that happened in
        your systems (an order shipped, a payment received…), so it can tell the
        customer in the chat. Requires the Meta AI Agent to be enabled for your
        account and set up on the number.
      operationId: sendAgentEvent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BusinessAgentEventRequest'
      responses:
        '200':
          description: The event was accepted. Use its `_id` to check its status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/BusinessAgentEvent'
        '400':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessAgentError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessAgentError'
        '404':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessAgentError'
        '409':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessAgentError'
        '500':
          description: Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BusinessAgentError'
components:
  schemas:
    BusinessAgentEventRequest:
      type: object
      required:
        - phoneId
        - to
        - type
        - description
      properties:
        phoneId:
          type: string
          description: >-
            The Meta phone number ID of your WhatsApp number (`phoneId` from
            **List WABA Accounts**).
          example: '123456789012345'
        to:
          type: string
          description: Customer phone number with country code.
          example: '919876543210'
        type:
          type: string
          maxLength: 256
          description: Short event name, e.g. `order_shipped`.
          example: order_shipped
        description:
          type: string
          maxLength: 1024
          description: What happened, in plain words, for the agent to act on.
          example: 'Order #1042 has shipped with BlueDart, AWB 1234567890.'
        payload:
          oneOf:
            - type: object
            - type: string
          description: >-
            Optional facts as a JSON object (or JSON string), at most 4096
            characters.
          example:
            order_id: '1042'
            tracking_url: https://track.example.com/1234567890
        contactId:
          type: string
          description: Optional AdsEra contact _id to link the event to.
    BusinessAgentEvent:
      type: object
      properties:
        _id:
          type: string
        phoneId:
          type: string
        to:
          type: string
        type:
          type: string
        description:
          type: string
        payload:
          type: string
        metaEventId:
          type: string
          nullable: true
        status:
          type: string
          description: Status from Meta, e.g. `accepted`.
        errorMessage:
          type: string
          nullable: true
        skippedReason:
          type: string
          nullable: true
        source:
          type: string
          example: api
        createdAt:
          type: string
          format: date-time
    BusinessAgentError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        code:
          type: string
          enum:
            - FEATURE_DISABLED
            - META_NOT_FOUND
            - NOT_ONBOARDED
            - INVALID_INPUT
            - TAKE_NOT_ALLOWED
            - SERVER_ERROR
        message:
          type: string
    ErrorResponse:
      type: object
      properties:
        status:
          type: integer
          example: 500
        success:
          type: boolean
          example: false
        error:
          type: string
          example: Internal Server Error!
  responses:
    Unauthorized:
      description: Unauthorized. The API keys are missing or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            status: 401
            success: false
            error: 'Unauthorized: Please provide valid API credentials.'
  securitySchemes:
    AppIdAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Your application's unique ID.
    AppSecretAuth:
      type: apiKey
      in: header
      name: x-api-secret
      description: Your application's secret key.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.