Skip to main content
POST

Overview

Assign a WhatsApp agent to one of your WhatsApp integrations, so the agent handles conversations on that number. A number has one agent; assigning another one replaces it. While assigning, Weya sets up the AiSensy webhook for the number so incoming messages reach the agent. For a pro integration, the credentials are checked with AiSensy first. If this setup fails, the agent isn’t assigned.

Prerequisites

Request

string
required
Your workspace API key. Create one from the profile menu in the dashboard → API Keys.
string
required
Integration ID (the _id from Get WhatsApp Numbers).
string
required
ID of the WhatsApp agent to assign.

Response

Error Handling

Errors return status: false, with the reason in errorMessage.
  • 400 Bad Request – phoneNumberId or agentId is missing or not a valid ID, or Failed to configure WhatsApp provider webhook: … (basic plan).
  • 401 Unauthorized – Missing or invalid API key.
  • 404 Not Found – WhatsApp number not found: it doesn’t exist or wasn’t connected by the user who owns the 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, or the AiSensy check failed (pro plan).
To undo the assignment, use Remove Agent from WhatsApp Number.