Skip to content
Chatwise
Skip to Content
Developer docs

Quickstart

Create an API key, make your first request and receive your first webhook.

View as Markdown

You need a Chatwise workspace you are an admin of, and Node.js 20 or later, or Python 3.9 or later, to run the samples.

1. Create an API key

  1. In the dashboard, open Settings → Developer → API Keys (open it).
  2. Select New key and name it.
  3. Choose Read conversations, Read messages, Read webhook endpoints and Manage webhook endpoints.
  4. Create it and copy the key. It is shown once.

Keep the key on your server, for example in an environment variable:

export CHATWISE_API_KEY='paste your key here'

2. Make a request

List the latest conversations:

curl 'https://api.chatwise.so/v1/conversations?limit=5' \
  -H "Authorization: Bearer $CHATWISE_API_KEY"

data holds the conversations, and pagination.nextCursor leads to the next page. An answer that isn't 2xx has a message that says what is wrong: see errors.

3. Receive a webhook

Chatwise sends events to a public https:// URL on port 443. While you develop, a tunnel to your machine gives you one.

Create the endpoint. Replace the URL with yours:

curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints' \
  -H "Authorization: Bearer $CHATWISE_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Quickstart",
  "url": "https://example.com/webhooks/chatwise",
  "events": ["message.received"]
}'

The answer has the endpoint's id and its signingSecret. The secret is shown only now, so keep it like the API key:

export CHATWISE_WEBHOOK_SECRET='paste the signing secret here'

Run a receiver. Copy the server and the function it uses from verify signatures into two files, and start it where your URL leads:

node server.mjs

Send a test event. Use the endpoint's id:

curl -X POST 'https://api.chatwise.so/v1/webhook-endpoints/we_01JE2Z3K8Q9V7W5X4Y3Z2A1B0C/test' \
  -H "Authorization: Bearer $CHATWISE_API_KEY"

The answer says what your endpoint did:

{
  "data": {
    "delivered": true,
    "statusCode": 204,
    "durationMs": 182,
    "error": null
  }
}

If delivered is false, see testing.

Write to your own inbox. Send a message to one of your connected accounts from another phone or account. Your receiver gets a message.received event.

Next

On this page