Update evolution-api skill with correct sendText payload schema and renumbered headers
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 1m0s
Details
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 1m0s
Details
This commit is contained in:
parent
13ee2d5569
commit
59ce33736b
|
|
@ -47,7 +47,26 @@ To fetch the QR code for scanning:
|
|||
|
||||
---
|
||||
|
||||
## 4. Troubleshooting: "Não foi possível conectar o dispositivo" / Connection Failure
|
||||
## 4. Sending a Text Message (v2.x.x Payload Schema)
|
||||
In Evolution API v2, the `POST /message/sendText/<instanceName>` endpoint expects a simplified body structure compared to v1.
|
||||
- **Method**: `POST`
|
||||
- **URL**: `https://<evolution_url>/message/sendText/<instanceName>`
|
||||
- **Headers**:
|
||||
- `apikey`: `<global_api_key>`
|
||||
- `Content-Type`: `application/json`
|
||||
- **Body**:
|
||||
```json
|
||||
{
|
||||
"number": "5585981145217",
|
||||
"text": "Your message here",
|
||||
"delay": 1200
|
||||
}
|
||||
```
|
||||
*Note: Do not use the legacy `textMessage` or `options` wrappers (like `{ options: { delay: 1200 }, textMessage: { text: "..." } }`), as these will return a `400 Bad Request` in v2.*
|
||||
|
||||
---
|
||||
|
||||
## 5. Troubleshooting: "Não foi possível conectar o dispositivo" / Connection Failure
|
||||
A common error during QR code scanning is `Não foi possível conectar o dispositivo` on the phone, while the API is stuck. This is caused by a corrupted Baileys session cache in the Evolution API container.
|
||||
|
||||
### Resolution Steps:
|
||||
|
|
@ -60,7 +79,7 @@ A common error during QR code scanning is `Não foi possível conectar o disposi
|
|||
|
||||
---
|
||||
|
||||
## 5. Reference Implementation (Node.js/Express)
|
||||
## 6. Reference Implementation (Node.js/Express)
|
||||
|
||||
```typescript
|
||||
import axios from 'axios';
|
||||
|
|
|
|||
|
|
@ -1372,8 +1372,8 @@ export async function sendWhatsappNotification(phone: string, text: string) {
|
|||
|
||||
await axios.post(`${apiUrl}/message/sendText/${instance}`, {
|
||||
number: cleanPhone,
|
||||
options: { delay: 1200 },
|
||||
textMessage: { text }
|
||||
text: text,
|
||||
delay: 1200
|
||||
}, {
|
||||
headers: { apikey: settings.evolutionApiKey }
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue