whatsapp-cloud-api

Whatsapp Cloud API Rust Client
[!WARNING] This crate has moved to
whatsapp-cloud-apiwill not receive further updates.To migrate, replace
whatsapp-cloud-api = "0.5"withwhatsapp = "0.6"inCargo.toml, andwhatsapp_cloud_api::withwhatsapp::in code.
Features
- Sending messages using Whatsapp Cloud API
- Get / Upload media
- Models to help processing incoming webhooks
Supported Graph API Version
This crate uses Facebook Graph API version v26.0 by default (v20.0 expires on 2026-09-24). You may change the version using the set_version() method. But, do it at your own risk :)
Usage example
Send template based text message
let access_token = "<access_token>";
let phone_number_id = "<phone_number_id>";
let to = "<to>";
let template_name = "hello_world";
let language = "en_US";
let template = new;
let message = from_template;
let client = new;
client.send_message.await?;
Send template based text message with parameters
let access_token = "<access_token>";
let phone_number_id = "<phone_number_id>";
let template_name = "sample_shipping_confirmation";
let language = "en_US";
let parameters = Vecfrom;
let components = Vecfrom;
let template = with_components;
let message = from_template;
let client = new;
let response = client.send_message.await?;
Send text message (Note: This requires an user initial conversation)
let access_token = "<access_token>";
let phone_number_id = "<phone_number_id>";
let to = "<to>";
let text = new;
let message = from_text;
let client = new;
client.send_message.await?;
For more details, please see the tests folder