A Cloudflare Worker that handles incoming Twilio messages by triggering a URAI callout.
This worker is designed to be used as a webhook for Twilio. When a POST request is received:
- It parses the incoming
From,To, andBodyfields from the form data. - It makes an authorized
POSTrequest to the URAI Voice API to initiate a callout to the sender. - The original SMS body is passed to URAI as metadata.
The worker requires several environment variables defined in wrangler.jsonc or as secrets:
URAI_ORG_ID: Your URAI Organization ID.URAI_AGENT_ID: The URAI Agent ID.URAI_API_KEY: Your URAI API secret key (should be added viawrangler secret put).
Start the development server:
npm run devDeploy the worker to Cloudflare:
npm run deployTo regenerate type definitions for the environment:
npm run cf-typegen