Skip to content
platform

Webhooks and events · Asynchronous webhook

Customers webhook

When it fires

The notification is sent when a customer is created or updated on CWS Platform. The payload carries the customer's registration data and addresses.

Example payload

Example from the public collection. The URL is your system's: the address below is only illustrative.

POST https://api.exemplo-cliente.com.br/webhook/clientes
Content-Type: application/json

{
    "id": 547322,
    "document": "29.701.244/0001-83",
    "name": "TEste meu S/A",
    "tradingName": "abacate 8",
    "contactName": "John Doe",
    "documentType": "pj",
    "dateCreated": "2023-01-25T19:59:58Z",
    "email": "contato@lojaexemplo.com.br",
    "phone": "(11) 99999-9990",
    "address": [
        {
            "id": 1060461,
            "name": "Endereço de cadastro",
            "street": "Rua Eugênio Lorenzetti",
            "number": "111",
            "complement": "teste",
            "quarter": "Jardim Íris",
            "city": "São Paulo",
            "state": "SP",
            "zipcode": "05144-000",
            "principal": true
        }
    ]
}

How to respond

This is asynchronous communication: the platform does not wait for a response to continue its processes.

The payload document is the key to look up and update the same customer through the API, in the opposite direction.

What the collection documents

This is an example payload for the Customer Webhook, sent when a customer is created or updated on the CWS Platform.

Where it is configured

The URL that receives this webhook is configured in the configuration panel, under Integrador > WebHook > Clientes. The same screen lists the delivery history and lets you resend notifications that failed.

The screen depends on activation for the store. If it does not show in your menu, ask the integration team to activate it.

Authentication of your endpoint

Authentication Overview

So that CWS can send Webhook notifications (Orders and Customers) securely, our system will first authenticate with yours to obtain an access token.

You must provide us with the details of your authentication endpoint so that we can configure it.

Token Endpoint Structure (Your Responsibility)

You will need to build a POST endpoint (e.g., /token) that, upon receiving the correct credentials, returns an access token. The response must follow the OAuth2 standard:

{
    "access_token": "SEU_TOKEN_GERADO",
    "expires_in": 3600
}

Below are three real examples of how your token endpoint can be configured.


Example 1: client_credentials Flow with Basic Auth

How it works: Your credentials (clientId and clientSecret) are combined, Base64-encoded and sent in the Authorization header.

Request that CWS will make to your token endpoint:

curl --location 'https://api.cliente.com.br/oauth/access-token' \
--header 'Authorization: Basic [SUAS_CREDENCIAS_EM_BASE64]' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials'

Example 2: Flow with clientId and clientSecret in the Body

How it works: Your credentials are sent directly in the request body in JSON format.

Request that CWS will make to your token endpoint:

curl --location 'https://api.cliente.com.br/v1/token' \
--header 'User-Agent: CWS Digital' \
--header 'Content-Type: application/json' \
--data '{
    "clientId": "SEU_CLIENT_ID",
    "clientSecret": "SEU_CLIENT_SECRET"
}'

Example 3: Flow with Credentials in Custom Headers

How it works: A non-standard model where the username and password are sent in specific headers, instead of using Authorization or the request body.

Request that CWS will make to your token endpoint:

curl --location --request POST 'https://api.cliente.com.br/rest/api/oauth2/v1/token?grant_type=password' \
--header 'username: SEU_USUARIO' \
--header 'password: SUA_SENHA'

Webhooks and events

Generated from the public API collection, published on 2026-09-04: api-docs.cws.digital.