Skip to main content

Chatwoot

Integration with Chatwoot via the "/api/v2/instance/{instanceId}/chatwoot-integration" endpoint allows the configuration and handling of interactions between a specific instance and Chatwoot. This integration is essential to control various aspects of the interaction between systems, offering effective and personalized communication.

Integration Overview

1. Integration Configuration:

  • POST: Configure a new integration.
  • PUT: Updates an existing integration.
  • GET: Retrieves integration information.
  • DELETE: Removes an integration.

2. Key Integration Components:

  • instanceId: Unique identifier of the instance.
  • accountId: Chatwoot account identifier.
  • enabled: Defines whether the integration is active.
  • chatwootURL: Chatwoot frontend URL.
  • chatwootAccessToken: Chatwoot access token.
  • webhookId: Webhook identifier for collecting API messages.
  • inbox: Information about the Chatwoot inbox.
  • integrationOptions: Additional integration options (e.g.: enabledGroup, displayAttendant).

Processing and Data Flow

It is important to note that the API does not perform direct data processing. A separate container, associated with the provided webhookId, is responsible for listening and processing the incoming information. This design allows for a clear separation between the configuration/integration interface (API) and data processing, ensuring greater flexibility and scalability.

Flow:

  1. Integration Request: A request is made to the specific endpoint, including the necessary details in the body of the request.
  2. Webhook and Processing: Messages received via webhook are processed by the designated container, allowing actions and responses based on the data received.

Practical Use

Companies and developers can use this endpoint to integrate their instances with Chatwoot, enabling everything from automatically sending messages to managing conversations and services, all through an API and processed by the container linked to the webhook.

Documentation and Examples

See Chatwoot Controller

The implementation of this system offers a robust and flexible means of integration between different platforms, capitalizing on Chatwoot's capabilities for communication management and customer service.


Chatwoot Connector

Docker Image: chatwoot/connector

Endpoint Configuration

  • Method: POST
  • Path: /webhook/chatwoot

Instructions for use

  1. Starting the Connector Container Use Docker Compose to upload the Chatwoot Connector container. The codechat_connector service must be configured as shown below:

    version: '3.3'
    services:
    codechat_connector:
    image: chatwoot/connector:develop
    networks:
    - public_network
    ports:
    - 8000:8000
    environment:
    - CONNECTOR_LICENSE_KEY=default_temporary_license
    - DATABASE_HOST=
    - DATABASE_PORT=
    - DATABASE_PASSWORD=
    - DATABASE_USER=postgres
    - SERVER_PORT=
    - DATABASE_NAME=chatwoot_production
    labels:
    ...
    networks:
    public_network:
    external: true
    name: public_network
  2. Proxy and Connector Configuration Choose and configure the proxy using Traefik or Nginx. Example configuration files can be found at the following links:

  3. Connector Testing and Validation Perform tests to ensure that the connector is working correctly. Use the curl command to send a test request and check the returns and logs:

    curl -X OPTIONS -H "Origin: https://apiv2.domain.dev" -H "Access-Control-Request-Method: GET" https://connector.docmain.com -I

    Observe the responses and confirm that requests are being processed properly.


Additional Notes:

  • Make sure environment variables are correctly set in Docker Compose.
  • For advanced configurations, see the official Traefik and Nginx documentation.
  • Keep configuration files and Docker versions up to date to ensure connector security and efficiency.