UNPKG

whatsapp-api-js

Version:

A TypeScript server agnostic Whatsapp's Official API framework

3 lines (2 loc) 507 B
import{WhatsAppAPIMiddleware}from"./globals.js";import{isInteger}from"../utils.js";class WhatsAppAPI extends WhatsAppAPIMiddleware{async handle_post(req){try{const body=await req.text();return this.post(JSON.parse(body||"{}"),body,req.headers.get("x-hub-signature-256")??"")}catch(e){return isInteger(e)?e:500}}handle_get(req){try{return this.get(Object.fromEntries(new URL(req.url).searchParams))}catch(e){throw isInteger(e)?e:500}}}export{WhatsAppAPI as default}; //# sourceMappingURL=web-standard.js.map