Always-on rules/secure-by-default.md: hosting, a11y, Supabase RLS, SMS/email consent, cloud functions, API hygiene incl. password storage. Stdlib scanner (FAIL/WARN/MANUAL) + skill, 89-check suite, auditor gate wiring, profiles, routing row (plus Explore rows confirmed through the router dialog).
17 lines
478 B
TypeScript
17 lines
478 B
TypeScript
import twilio from "npm:twilio";
|
|
|
|
const client = twilio(Deno.env.get("TWILIO_SID"), Deno.env.get("TWILIO_TOKEN"));
|
|
|
|
Deno.serve(async (request) => {
|
|
const user = await getUser(request);
|
|
const contact = await loadContact(user.id);
|
|
if (!contact.consent_at || contact.opt_out_at) {
|
|
return new Response("skipped");
|
|
}
|
|
await client.messages.create({
|
|
to: contact.phone,
|
|
body: "Your offer is ready. Reply STOP to opt out.",
|
|
});
|
|
return new Response("sent");
|
|
});
|