Draft: experiment with Twilio SMS/RCS channel backend#178
Draft
bglusman wants to merge 2 commits into
Draft
Conversation
0f8cb60 to
1bd8fd2
Compare
There was a problem hiding this comment.
Pull request overview
This PR experiments with adding a Twilio-backed provider option for Calciforge’s existing kind = "sms" channel, alongside the current Linq integration, including webhook ingestion, signature validation, outbound sends, and supporting documentation/config validation.
Changes:
- Adds
sms_provider = "twilio"support to the SMS channel, including Twilio inbound form parsing + signature verification and outbound sends via Twilio’s Message resource. - Extends config schema + validation (and tests) to cover Twilio credentials, sender configuration, and webhook public URL requirements.
- Updates channel documentation to describe provider differences (SMS + WhatsApp capability notes) and adds the
sha1dependency for Twilio HMAC verification.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/index.md | Updates the channel list description to mention Twilio as an SMS/RCS webhook option. |
| docs/channels/whatsapp.md | Documents WhatsApp backend limitations vs official provider APIs and Baileys-style experiments. |
| docs/channels/sms.md | Adds provider-oriented docs and a Twilio configuration + webhook verification section. |
| crates/calciforge/src/main.rs | Updates startup log messaging for the SMS channel. |
| crates/calciforge/src/config/validator.rs | Validates sms_provider and required Twilio/Linq fields; adds focused tests. |
| crates/calciforge/src/config.rs | Extends ChannelConfig with Twilio-specific fields and adds a parsing test. |
| crates/calciforge/src/channels/sms.rs | Implements Twilio transport, webhook handler, signature verification, and outbound send logic. |
| crates/calciforge/Cargo.toml | Adds sha1 dependency for Twilio HMAC-SHA1 signature verification. |
| Cargo.lock | Locks the new sha1 dependency. |
Comments suppressed due to low confidence (1)
crates/calciforge/src/channels/sms.rs:851
read_secret_filehardcodes the prefix "Text/iMessage" in its error context. With the new Twilio backend, failures readingsms_twilio_*secrets will report as "Text/iMessage", which is misleading. Consider switching this prefix to something provider-neutral like "SMS"/"SMS channel" (or including the provider name) so Twilio configuration errors are clearer.
fn read_secret_file(path: &str, label: &str) -> Result<String> {
Ok(std::fs::read_to_string(expand_tilde(path))
.with_context(|| format!("Text/iMessage: failed to read {label} '{path}'"))?
.trim()
.to_string())
Comment on lines
+522
to
+531
| #[derive(Debug, Clone)] | ||
| struct TwilioChannel { | ||
| account_sid: String, | ||
| auth_token: String, | ||
| from: Option<String>, | ||
| messaging_service_sid: Option<String>, | ||
| allowed_senders: Vec<String>, | ||
| api_base: String, | ||
| client: reqwest::Client, | ||
| } |
| messaging_service_sid, | ||
| allowed_senders, | ||
| api_base: "https://api.twilio.com".to_string(), | ||
| client: reqwest::Client::new(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Experimental channel work for Twilio SMS/RCS and current WhatsApp capability limits.
sms_provider = "twilio"alongside the existing Linq-backedkind = "sms"channel.MessagingServiceSidorFrom.Scope Notes
This is deliberately an experiment branch. It does not merge Matrix E2EE work, does not change the docs-public-copy branch, and does not claim full RCS native suggested-reply rendering yet.
Known follow-ups if we like this direction:
Validation
cargo fmt --checkcargo test -p calciforge twilio -- --nocapturecargo test -p calciforge channels::sms:: -- --nocapturecargo test -p calciforge test_channel_docs_sms_toml_blocks_valid -- --nocaptureruby scripts/check-docs-site.rbgit diff --check