CloudZAPI Documentation

website·Indexed 30 days ago

https://docs.cloudzapi.com

API documentation for CloudZAPI, featuring endpoints for sending various message types (media, location, audio, reactions, and link previews), managing business catalogs and products, and handling instance profiles. Includes integration guides for Typebot and Chatwoot, as well as comprehensive webhook event mapping for messages, chats, contacts, and queue management.

Tokens
19.4K
Snippets
103
Records
162
Agent score
50%

What's inside CloudZAPI

  1. Overview of CodeChat WhatsApp API

    CodeChat is an API that enables robust, real-time interaction with WhatsApp via Webhooks. It is designed for developers and IT professionals to build business applications, interactive chatbots, and other communication solutions by integrating WhatsApp functionality into their own systems.
  2. Manage Typebot conversational bot integrations

    The /typebot-integration endpoint allows you to manage the connection between your application and Typebot, a conversational bot platform. This integration is used for automating customer service, lead generation, and feedback collection across different platforms.
  3. Handle the contacts.set webhook event

    The contacts.set event is triggered to send the loaded contact list. This is primarily used to get an overview of contacts at the start of a session.
    {
       "event": "contacts.set",
       "instance": {
         "owner": "[email protected]",
         "name": "codechat",
         "id": "d4a58666-9737-485d-988b-d18a43ce8c75"
       },
       "data": [
         {
           "phoneNumber": "5531900000000",
           "wuid": "[email protected]",
           "profilePictureUrl": "https://pps.whatsapp.net/v/t61.24694-24/[...].jpg?[...]",
           "instanceName": "codechat"
         }
       ]
    }
  4. Manage Chatwoot integration settings

    The /chatwoot/integration endpoint allows developers to connect their platforms with Chatwoot for conversation-based customer support. The integration supports three primary operations: defining a new integration (POST), updating existing settings (PUT), and retrieving current integration data (GET).
  5. Understand the update.log webhook event structure

    The update.log event provides detailed information about an application log entry. It includes the event name, instance details (owner, name, and unique ID), the log level (logType), and the log content (logValue). The logValue can contain specific location data and detailed response objects, such as error messages, stack traces, and HTTP status codes for ERROR type logs.
    {
       "event": "update.log",
       "instance": {
         "owner": "[email protected]",
         "name": "codechat",
         "id": "d4a58666-9737-485d-988b-d18a43ce8c75"
       },
       "logType": "ERROR",
       "logValue": {
         "location": "WebhookProcessor.standardShipping",
         "response": {
           "message": "Request failed with status code 502",
           "name": "AxiosError",
           "stack": "AxiosError: Request failed with status code 502\n at settle ...",
           "config": {},
           "code": "ERR_BAD_RESPONSE",
           "status": 502
         }
       }
    }
  6. Retrieve instance information via /instance/fetchInfo

    v3
    Use the GET /instance/fetchInfo endpoint to retrieve detailed information about a specific instance. A successful request returns a 201 status code with a JSON object containing the instance's identity, profile details, and timestamps.
    GET /instance/fetchInfo
  7. Handle application log webhook events

    Application logs are sent to the /update/logs path of the registered webhook. The system transmits three types of log levels: INFO, WARN, and ERROR. These logs can contain simple messages or complex objects used for monitoring and diagnosing application behavior.
  8. Enable automatic webhook path routing

    v3

    The autoPath query parameter determines how events are routed to your webhook URL.

    • If autoPath is false (or omitted), all events are sent to the base default URL.
    • If autoPath=true, the system appends a specific path to the base URL based on the event type, allowing you to handle different events at different endpoints.
    Example Path Mappings:
    - chats.set / chats.update / chats.delete  => /api/chats
    - contacts.update / contacts.upsert        => /api/contacts
    - new.message / send.message               => /api/new-message
    - send.message:START/PROCESSING/COMPLETED/ERROR => /api/send-message-queue
    - paused/resumed/deleted.queue             => /api/queue-manager
    - messages.delete                          => /api/messages-delete
    - messages.update                          => /api/messages-update
    - messages.set                             => /api/messages-set
    - presence.update                           => /api/presence-update
    - request/send/decline/cancel.payment       => /api/payment
    - general.error                             => /api/general-error
    
    Mandatory events (cannot be disabled):
    - connection.update                         => /api/connection-update
    - qrcode.updated                            => /api/qrcode-updated
    - reject.call                               => /api/reject-call
  9. Configure message options for delays and mentions

    v3

    Messages can include an options object to control delivery behavior:

    • delay: An integer or an array of two integers (min/max) to determine the sending delay.
    • quoted: The messageId of the message to be quoted.
    • mentions: Used for group participants:
      • everyone: Mention all participants. This overrides the mentioned attribute.
      • ghostMention: Used with everyone to mention all participants without adding direct text references.
      • mentioned: An array of specific phone numbers to mention.
    {
      "numbers": ["5531911111111"],
      "options": {
        "delay": 1200, // or [1200, 8000]
        "mentions": {
          "mentioned": ["5531911111111", "5531922222222"]
        }
      },
      "textMessage": {
        "text": "Hello @5531911111111 and @5531922222222"
      }
    }
  10. Manage message options and mentions

    v3

    The options object allows for advanced message control:

    • delay (number): A single integer or an array of two-position integers to delay sending.
    • quoted (object): Used to quote a previous message. Requires messageId (string).
    • presence (string): Sets the chat status. Valid values: paused, composing, unavailable, available, recording.
    • mentions (object): Used for group chats.
      • everyone (boolean): Set to true to mention everyone in the group (default: false).
      • ghostMention (boolean): Mention all participants without direct referencing (default: false).
      • mentioned (string[]): A list of specific participant IDs to mention.
  11. Configure media message parameters

    v3

    When sending a media message, the mediaMessage object requires the following fields:

    • fileName (string, required): The name of the file including its extension.
    • urlOrId (string, required): The URL or ID of the media file.
    • mediaType (string): The type of media being sent.
    • caption (string): An optional description or title for the media.