English
English
Appearance
English
English
Appearance
/public/account/whatsapp/connect/{accountId}Restore a WhatsApp account that has lost its connection, for example because the user logged the device out from their phone. Create a new session, have the user scan the QR code with the same number, then send the new token here.
Authorization: Basic Base64(AccessKey:SecretKey))| Parameter | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | The unique ID of the account. |
| Field | Type | Required | Description |
|---|---|---|---|
token | string | Yes | The new session token from Create Session WhatsApp, after Get Session WhatsApp reports isConnected: true. |
curl -X POST "https://api.repliz.com/public/account/whatsapp/connect/680affa5ce12f2f72916f67e" \
-H "Authorization: Basic $(echo -n 'YOUR_ACCESS_KEY:YOUR_SECRET_KEY' | base64)" \
-H "Content-Type: application/json" \
-d '{"token":"SESSION_TOKEN"}'import axios from 'axios';
const accountId = '680affa5ce12f2f72916f67e';
const response = await axios.post(
`https://api.repliz.com/public/account/whatsapp/connect/${accountId}`,
{
token: 'SESSION_TOKEN',
},
{
auth: {
username: 'YOUR_ACCESS_KEY',
password: 'YOUR_SECRET_KEY',
},
},
);
console.log(response.data);const credentials = btoa('YOUR_ACCESS_KEY:YOUR_SECRET_KEY');
const accountId = '680affa5ce12f2f72916f67e';
const response = await fetch(
`https://api.repliz.com/public/account/whatsapp/connect/${accountId}`,
{
method: 'POST',
headers: {
Authorization: `Basic ${credentials}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
token: 'SESSION_TOKEN',
}),
},
);
const data = await response.json();
console.log(data);// No content returned on success{
"code": 400,
"message": "incorrect generatedId to reconnect"
}{
"code": 403,
"message": "invalid status session"
}// Account Not Found
{
"code": 404,
"message": "account not found"
}
// Session Not Found
{
"code": 404,
"message": "session not found"
}{
"code": 401,
"message": "unauthorized"
}400 means the QR code was scanned with a different WhatsApp number than the one this account belongs to. Create a new session and scan with the original number. To add a different number, use Connect WhatsApp instead.403 invalid status session means the QR code has not been scanned yet. Keep polling Get Session WhatsApp until isConnected is true.404 session not found means the session expired before the call. Create a new session and scan again.