#twilio #messaging #telephony #api

rusty_twilio

A Rust library for interacting with the Twilio API

2 releases

new 0.1.1 Apr 4, 2025
0.1.0 Apr 4, 2025

#7 in #telephony


Used in elevenlabs_twilio

MIT license

125KB
3K SLoC

Contributing

Contributions are welcome.

Create Call

use rusty_twilio::endpoints::voice::call::{CreateCall, CreateCallBody};
use rusty_twilio::{Result, TwilioClient};

#[tokio::main]
async fn main() -> Result<()> {
    let client = TwilioClient::from_env()?;

    let body = CreateCallBody::new("to", "from", "http://demo.twilio.com/docs/voice.xml");

    // or to set other fields
    //let body = CreateCallBody {
    //    to: "to",
    //    from: "from",
    //    url: Some("http://demo.twilio.com/docs/voice.xml"),
    //    status_callback: Some("http://example.com/callback"),
    //    status_callback_event_initiated: Some(true),
    //    status_callback_event_answered: Some(true),
    //    ..Default::default()
    //};

    let endpoint = CreateCall::new(client.account_sid(), body);

    let resp = client.hit(endpoint).await?;

    println!("{:?}", resp);
    Ok(())
}

Dependencies

~10–23MB
~327K SLoC