Texting (SMS)
Status
| Line | Texting |
|---|---|
| Best Deal On (727) 632-0002 | Off. sms_enabled: false. Texting waits for carrier (A2P 10DLC) approval and for John's word that "the whole system is working". The campaign is a draft, not submitted (Callbots workspace draft). |
The Best Deal On bot says that voice and email work today and texting is "a feature that turns on after a one-time carrier approval". It never offers texts (commit 56864d2; tenant extra_instructions).
Other lines (RF Safe) are out of scope for this wiki.
The gate (code)
- At creation, every tenant created through the API gets
sms_enabled = false, "texting only after A2P approval" (src/app.js:177). setSmsturns it on (src/app.js:270-283). It is called from the API (src/app.js:204) and from/admin/channels. Turning it on requires:- the tenant's first number to be E.164,
- a
messaging_service_sidmatchingMG+32 hex, - Twilio's Messaging Service sender pool to actually contain that number.
- Otherwise it fails with a plain error (
CH_ERR,src/app.js:283).
- If texting is off, the SMS tools return
texting_not_yet_enabled(src/tools.js:135,222). The prompt says not to offer texts (src/xai.js:67,86-91). The readiness check flags it (src/readiness.js:33). - Every customer text goes through
sendCustomerSms. It checks consent first: the person must have contacted the business and must not have opted out (src/twilio.js:55-60). It sends through the Messaging Service when one is set. The STOP, START and HELP keywords are handled.
Diagram source (Mermaid)
flowchart TD
A[Owner asks to turn texting on] --> B{"first number is +1 E.164?"}
B -- no --> X1[409 no_number]
B -- yes --> C{"messaging_service_sid is MG plus 32 hex?"}
C -- no --> X2[400 invalid]
C -- yes --> D[Read Twilio sender pool]
D -- error --> X3[502 pool_check_failed]
D --> E{number in pool?}
E -- no --> X4[409 number_not_in_sender_pool]
E -- yes --> F[sms_enabled=true, save]Email fallback (until texting is approved)
- With
email_enabled, the bot asks for the caller's email, reads it back to confirm, and emails the links through Resend (set_email_address/send_email,src/tools.js:53,181,213[bdo]). - The sender comes from
brand.email_from(Best Deal On: support@bestdealon.app). - Only allowlisted links are kept (
src/email.js:20-26). - Test guard: when
PA_EMAIL_ALLOW_ONLYis set, a recipient must be on the list or be the address the caller confirmed on that call (src/email.js:10,63[bdo]).
Planned
- Submit Best Deal On's A2P brand and campaign. Fees aren't paid yet. Waiting on John.
- Fix the site items 13–16 on the punch list before submitting.