Skip to main content
POST

Overview

Connect a WhatsApp Business number to Weya, for the user who owns the API key. WhatsApp numbers are connected through AiSensy, using your AiSensy API token. There are two plans:
  • basic (default) – the number and token are saved as sent. Check them first with Validate WhatsApp Number.
  • pro – also needs your AiSensy projectId. The credentials are checked with AiSensy and Weya subscribes to the project’s message events before the number is saved.
The response’s _id is the ID that the other WhatsApp endpoints call phoneNumberId.

Prerequisites

  • An API key for your workspace
  • An AiSensy account with the WhatsApp number connected, and its API token

Request

string
required
Your workspace API key. Create one from the profile menu in the dashboard → API Keys.

Request Parameters

string
required
Always AI_SENSY.
string
required
The WhatsApp Business number, with country code.
string
required
Your AiSensy API token.
string
default:"basic"
basic or pro.
string
Your AiSensy project ID. Required when plan is pro.

Response

string
Integration ID. Use it as phoneNumberId in the other WhatsApp endpoints.
string
basic or pro.
string
The AiSensy token you sent, in plain text. Don’t log the response.
string
pro only: configured when Weya is subscribed to the project’s events.

Error Handling

Errors return status: false, with the reason in errorMessage.
  • 400 Bad Request
    • provider isn’t AI_SENSY, phoneNumber or token is missing, or projectId is missing for pro.
    • WhatsApp integration already exists for this phone number.
    • pro: WhatsApp integration already exists for this AiSensy project, or AiSensy rejected the credentials.
  • 401 Unauthorized – Missing or invalid API key.
  • 429 Too Many Requests – More than 1,000 WhatsApp requests in 15 minutes from your IP address.
  • 500 Internal Server Error – Unexpected server error.
Typical workflow:
  1. Validate WhatsApp Number.
  2. Create the integration (this endpoint).
  3. Create WhatsApp Agent.
  4. Assign the agent to the number.