Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy Twilio Neon Worker

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: ⬇️ Checkout Repository
uses: actions/checkout@v4

- name: 🟦 Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: 📦 Install Dependencies
run: npm install

- name: ⚙️ Build Worker
run: npm run build

- name: ☁️ Deploy to Cloudflare Workers
run: npx wrangler deploy
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
Empty file added twilio-neon/README.md
Empty file.
28 changes: 28 additions & 0 deletions twilio-neon/cloudflare/inbox-handler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const handler = {
async fetch(request: Request): Promise<Response> {
const form = await request.formData();
const message = (form.get("Body") || "").toString().toLowerCase();
const sender = form.get("From") || "unknown";

let reply = "🤖 Neon Covenant AI: Reply with 'confirm', 'reschedule', or 'help'.";

if (message.includes("confirm")) {
reply = "✅ Delivery confirmed for Dec 1 at 3pm. Thank you.";
} else if (message.includes("reschedule")) {
reply = "📆 Please reply with your new desired delivery time.";
} else if (message.includes("help")) {
reply = "🧙‍♂️ Support: Visit https://help.neoncovenant.com for assistance.";
}

const twiml = `<Response><Message>${reply}</Message></Response>`;

return new Response(twiml, {
headers: {
"Content-Type": "application/xml",
},
});
},
};

export default handler;

24 changes: 24 additions & 0 deletions twilio-neon/dist/inbox-handler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const handler = {
async fetch(request) {
const form = await request.formData();
const message = (form.get("Body") || "").toString().toLowerCase();
const sender = form.get("From") || "unknown";
let reply = "🤖 Neon Covenant AI: Reply with 'confirm', 'reschedule', or 'help'.";
if (message.includes("confirm")) {
reply = "✅ Delivery confirmed for Dec 1 at 3pm. Thank you.";
}
else if (message.includes("reschedule")) {
reply = "📆 Please reply with your new desired delivery time.";
}
else if (message.includes("help")) {
reply = "🧙‍♂️ Support: Visit https://help.neoncovenant.com for assistance.";
}
const twiml = `<Response><Message>${reply}</Message></Response>`;
return new Response(twiml, {
headers: {
"Content-Type": "application/xml",
},
});
},
};
export default handler;
9 changes: 9 additions & 0 deletions twilio-neon/inbox-handler.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
addEventListener('fetch', event => {
event.respondWith(
new Response('Hello from Neon WhatsApp Bot!', {
status: 200,
headers: { 'Content-Type': 'text/plain' },
})
)
})

19 changes: 19 additions & 0 deletions twilio-neon/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "twilio-neon",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"build": "tsc",
"deploy": "wrangler deploy",
"send": "node scripts/send-whatsapp.js"
},
"dependencies": {
"dotenv": "^16.0.0",
"php": "^1.1.0",
"twilio": "^4.0.0"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20250618.0",
"typescript": "^5.8.3"
}
}
Empty file.
13 changes: 13 additions & 0 deletions twilio-neon/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"outDir": "dist",
"moduleResolution": "Node",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true
},
"include": ["cloudflare"]
}

11 changes: 11 additions & 0 deletions twilio-neon/wrangler.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name = "neon-whatsapp-bot"
main = "dist/inbox-handler.js"
compatibility_date = "2025-06-18"
compatibility_flags = ["nodejs_compat"]
usage_model = "bundled"
modules = true

[build]
command = "npm run build"


Loading