Skip to main content

Crate sms_twilio

Crate sms_twilio 

Source
Expand description

§Twilio SMS Provider

Twilio backend for the smskit multi-provider SMS abstraction.

§Sending messages

ⓘ
use sms_core::{SendRequest, SmsClient};
use sms_twilio::TwilioClient;

let client = TwilioClient::new("ACXXXXXXXX", "your_auth_token");
let response = client.send(SendRequest {
    to: "+14155551234",
    from: "+10005551234",
    text: "Hello from Twilio!",
}).await?;
println!("Message SID: {}", response.id);

§Creating from environment variables

ⓘ
let client = TwilioClient::from_env()?;

Reads TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN from the environment.

§Webhook signature verification

The InboundWebhook implementation includes Twilio request signature verification using HMAC-SHA1. Pass your webhook URL via TwilioClient::with_webhook_url to enable it.

Structs§

TwilioClient
Twilio REST API client.
TwilioInbound
The form-encoded payload that Twilio POSTs to your webhook URL when an inbound SMS arrives.