Skip to content

Latest commit

 

History

History

whatsapp-with-vonage

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

💬 Deno WhatsApp Bot with Vonage Function

Simple bot to answer WhatsApp messages.

🧰 Usage

GET /

HTML form for interacting with the function.

POST /

Receives a message, validates its signature, and sends a response back to the sender.

Parameters

Name Description Location Type Sample Value
Content-Type Content type of the request Header application/json N/A
Authorization Webhook signature for verification Header String Bearer <signature>
from Sender's identifier. Body String 12345
text Text content of the message. Body String Hello!

All parameters are coming from Vonage webhook. Exact documentation can be found in Vonage API Docs.

Response

Sample 200 Response:

{
  "ok": true
}

Sample 400 Response:

{
  "ok": false,
  "error": "Missing required parameter: from"
}

Sample 401 Response:

{
  "ok": false,
  "error": "Payload hash mismatch."
}

⚙️ Configuration

Setting Value
Runtime Deno (1.35)
Entrypoint src/main.ts
Build Commands deno cache src/main.ts
Permissions any
Timeout (Seconds) 15

🔒 Environment Variables

VONAGE_API_KEY

API Key to use the Vonage API.

Question Answer
Required Yes
Sample Value 62...97
Documentation Vonage: Q&A

VONAGE_API_SECRET

Secret to use the Vonage API.

Question Answer
Required Yes
Sample Value Zjc...5PH
Documentation Vonage: Q&A

VONAGE_API_SIGNATURE_SECRET

Secret to verify the webhooks sent by Vonage.

Question Answer
Required Yes
Sample Value NXOi3...IBHDa
Documentation Vonage: Webhooks

VONAGE_WHATSAPP_NUMBER

Vonage WhatsApp number to send messages from.

Question Answer
Required Yes
Sample Value 14000000002
Documentation Vonage: Q&A