<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: pbisjoint</title>
    <description>The latest articles on DEV Community by pbisjoint (@pbisjoint).</description>
    <link>https://dev.to/pbisjoint</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4257125%2Fe55ccb04-5658-4605-b83b-189b2a820cac.png</url>
      <title>DEV Community: pbisjoint</title>
      <link>https://dev.to/pbisjoint</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pbisjoint"/>
    <language>en</language>
    <item>
      <title>I built a missed-call text-back + AI lead reply system on Cloudflare Workers (open source)</title>
      <dc:creator>pbisjoint</dc:creator>
      <pubDate>Sat, 21 Nov 2026 10:22:04 +0000</pubDate>
      <link>https://dev.to/pbisjoint/i-built-a-missed-call-text-back-ai-lead-reply-system-on-cloudflare-workers-open-source-23ha</link>
      <guid>https://dev.to/pbisjoint/i-built-a-missed-call-text-back-ai-lead-reply-system-on-cloudflare-workers-open-source-23ha</guid>
      <description>&lt;p&gt;Local service businesses (plumbers, HVAC, roofers, electricians) miss a lot of calls. They're on a ladder, under a sink, or driving. Most callers who hit voicemail don't leave a message; they just call the next company on Google.&lt;/p&gt;

&lt;p&gt;So I built a small, open-source system that fixes that with three automations, running on a single Cloudflare Worker:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Missed-call text-back:&lt;/strong&gt; calls still ring the owner's phone. If nobody answers, the caller gets a friendly text within seconds and the owner gets an alert.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant AI lead reply:&lt;/strong&gt; website form leads get a short, personal SMS written by Claude in seconds, 24/7. If the AI call fails, a safe template goes out instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review requests:&lt;/strong&gt; after a job, the customer gets a text with the Google review link.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Code:&lt;/strong&gt; &lt;a href="https://github.com/pbisjoint/missed-call-text-back-ai" rel="noopener noreferrer"&gt;https://github.com/pbisjoint/missed-call-text-back-ai&lt;/a&gt; (MIT licensed)&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Caller -&amp;gt; Twilio number -&amp;gt; /voice (Worker) -&amp;gt; &amp;lt;Dial&amp;gt; owner's phone (20s)
                                   |
                     no answer -&amp;gt; /voice/status -&amp;gt; SMS to caller + alert to owner

Web form -&amp;gt; /lead -&amp;gt; Claude drafts reply -&amp;gt; SMS to lead + alert to owner
Job done -&amp;gt; /review -&amp;gt; SMS with review link
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The whole thing is ~250 lines of plain JavaScript with no dependencies. Cloudflare's free Workers tier covers typical small-business volume, so the running cost is basically the Twilio number plus SMS fees and a few cents of Claude usage.&lt;/p&gt;

&lt;h2&gt;
  
  
  The missed-call part
&lt;/h2&gt;

&lt;p&gt;Twilio hits &lt;code&gt;/voice&lt;/code&gt; when someone calls. The Worker returns TwiML that forwards the call to the owner with a timeout and an &lt;code&gt;action&lt;/code&gt; callback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;twiml&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="sb"&gt;`&amp;lt;Response&amp;gt;&amp;lt;Dial timeout="20" action="${statusUrl}" method="POST"&amp;gt;`&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
  &lt;span class="sb"&gt;`${env.OWNER_PHONE}&amp;lt;/Dial&amp;gt;&amp;lt;/Response&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the dial ends, Twilio posts &lt;code&gt;DialCallStatus&lt;/code&gt; to &lt;code&gt;/voice/status&lt;/code&gt;. Anything other than &lt;code&gt;completed&lt;/code&gt; means nobody picked up, so the caller gets a text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't skip signature validation
&lt;/h2&gt;

&lt;p&gt;Any public webhook URL will get hit by random traffic. The Worker verifies &lt;code&gt;X-Twilio-Signature&lt;/code&gt; (HMAC-SHA1 of the URL plus sorted POST params) with WebCrypto and rejects anything that doesn't match. The test suite checks the implementation against the example in Twilio's own security docs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping the AI reply safe
&lt;/h2&gt;

&lt;p&gt;The system prompt is deliberately narrow: under 300 characters, acknowledge the issue, say someone will call shortly, ask one useful question (address, urgency or a photo). It never quotes prices or promises arrival times. The model output is trimmed and capped before sending, and there's a fallback template if the API errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup in about 30 minutes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Buy a Twilio number (in the US, register for A2P 10DLC first)&lt;/li&gt;
&lt;li&gt;Edit &lt;code&gt;wrangler.toml&lt;/code&gt; with the business details&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;wrangler secret put&lt;/code&gt; the Twilio token, Anthropic key and an API key&lt;/li&gt;
&lt;li&gt;&lt;code&gt;npx wrangler deploy&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Point the Twilio number's voice webhook to &lt;code&gt;/voice&lt;/code&gt; and the site's form webhook to &lt;code&gt;/lead?key=...&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Run &lt;code&gt;npm test&lt;/code&gt; to check the 10 tests: signature checks, forwarding, missed-call texts, auth, AI reply with fallback, and reviews.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compliance notes
&lt;/h2&gt;

&lt;p&gt;Only text people who contacted the business, add consent wording to the form, and honour STOP replies (Twilio handles STOP/HELP automatically).&lt;/p&gt;

&lt;h2&gt;
  
  
  Want it set up for you?
&lt;/h2&gt;

&lt;p&gt;If you run a local business (or an agency with clients who miss calls) and want this deployed for you, open an issue titled "Setup request" on the repo with your business type and city, and I'll reply with a fixed quote.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This post and the code were written with help from Claude.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>ai</category>
      <category>cloudflare</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
