vonage-node-code-snippets
vonage-node-code-snippets copied to clipboard
Whatsapp Send Message Error: 422: Unprocessible Entity
I want to send whatsapp text message using following code:
https://github.com/Vonage/vonage-node-code-snippets/blob/v3-messages/messages/whatsapp/send-text.js
But I met 422-Unprocessible Entity.
This is Error Message
VetchError: Request failed with status code 422
at Messages.parseResponse (/home/ginger/Projects/codenameChatLogics/server/node_modules/@vonage/server-client/dist/client.js:303:19)
at Messages.sendRequest (/home/ginger/Projects/codenameChatLogics/server/node_modules/@vonage/server-client/dist/client.js:222:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Messages.sendRequestWithData (/home/ginger/Projects/codenameChatLogics/server/node_modules/@vonage/server-client/dist/client.js:197:16)
at async Messages.send (/home/ginger/Projects/codenameChatLogics/server/node_modules/@vonage/messages/dist/messages.js:73:22)
at async Service.outbound (file:///home/ginger/Projects/codenameChatLogics/server/src/services/whatsapp.service.js:20:18)
at async file:///home/ginger/Projects/codenameChatLogics/server/src/routes/agent/vonage/whatsapp.js:13:16 {
config: {
url: 'https://api.nexmo.com/v1/messages',
method: 'POST',
type: 'application/json',
data: {
to: '1508***9382',
from: '1201***3027',
text: 'Hello, I sent this message via Vonage API',
message_type: 'text',
channel: 'whatsapp'
},
headers: {
'user-agent': '@vonage/server-sdk/3.0.0, node/20.12.2,',
'content-type': 'application/json',
Authorization: 'Bearer eyJh*****LQxA'
}
},
response: Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: false, error: null },
[Symbol(Response internals)]: {
url: 'https://api.nexmo.com/v1/messages',
status: 422,
statusText: 'Unprocessable Entity',
headers: [Headers],
counter: 0
}
}
}