Rust API client for onesignal-rust-api
A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
For more information, please visit https://onesignal.com
- API version: 5.4.0
- Package version: 5.4.0
Installation
Add to Cargo.toml under [dependencies]:
= "5.4.0"
Configuration
Every SDK requires authentication via API keys. Two key types are available:
- REST API Key — required for most endpoints (sending notifications, managing users, etc.). Found in your app's Settings > Keys & IDs.
- Organization API Key — only required for organization-level endpoints like creating or listing apps. Found in Organization Settings.
Warning: Store your API keys in environment variables or a secrets manager. Never commit them to source control.
use Configuration;
Send a push notification
use default_api;
use ;
let mut contents = new;
contents.en = Some;
let mut headings = new;
headings.en = Some;
let mut notification = new;
notification.contents = Some;
notification.headings = Some;
notification.included_segments = Some;
let config = create_configuration;
let response = create_notification.await;
Send an email
let mut notification = new;
notification.email_subject = Some;
notification.email_body = Some;
notification.included_segments = Some;
notification.channel_for_external_user_ids = Some;
let response = create_notification.await;
Send an SMS
let mut contents = new;
contents.en = Some;
let mut notification = new;
notification.contents = Some;
notification.included_segments = Some;
notification.channel_for_external_user_ids = Some;
notification.sms_from = Some;
let response = create_notification.await;
Full API reference
The complete list of API endpoints and their parameters is available in the DefaultApi documentation.
For the underlying REST API, see the OneSignal API reference.