clicksend-rs 0.1.0

Unofficial ClickSend SDK for Rust (async + optional blocking).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Demo: parse an inbound SMS webhook payload.

use clicksend_rs::webhook::parse_inbound_sms;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let sample = br#"{
        "message_id": "abc123",
        "from": "+15551234567",
        "to": "+15557654321",
        "body": "STOP",
        "timestamp": 1700000000,
        "originator": "clicksend"
    }"#;

    let parsed = parse_inbound_sms(sample)?;
    println!("inbound from {:?}: {:?}", parsed.from, parsed.body);
    Ok(())
}