twilio_rust

Crates.iotwilio_rust
lib.rstwilio_rust
version0.1.0
sourcesrc
created_at2017-12-03 02:20:20.207806
updated_at2017-12-03 02:20:20.207806
descriptionAn async client library for Twilio based on hyper
homepagehttps://github.com/juggernaut/twilio_rust
repositoryhttps://github.com/juggernaut/twilio_rust
max_upload_size
id41507
size42,768
Ameya Lokare (juggernaut)

documentation

https://github.com/juggernaut/twilio_rust

README

twilio_rust

A rust-lang client library for Twilio based on hyper.rs. As such, network I/O is done asynchronously and all results are returned as futures.

Getting started

Let's start with an example of sending an SMS (You can run this example with cargo run --example send_message).

You will need your Twilio credentials first:

export ACCOUNT_SID=<your account sid>
export AUTH_TOKEN=<your auth token>
// Create the tokio event loop
let mut core = Core::new().unwrap();

// Create the twilio client
let client = Client::new_from_env(&core.handle()).unwrap();

let messages = Messages::new(&client);

// Create the outbound SMS
let outbound_sms = OutboundMessageBuilder::new_sms(
    MessageFrom::From(&from_num),
    &to_num,
    "Hello from Rust!"
).build();

let work = messages.send_message(&outbound_sms);
let sms = core.run(work).unwrap();
println!("Queued outbound SMS {}", sms.sid);
Commit count: 51

cargo fmt