Crates.io | simple-tencent-sms |
lib.rs | simple-tencent-sms |
version | 0.1.2 |
source | src |
created_at | 2024-11-05 05:56:22.263901 |
updated_at | 2024-11-05 14:03:58.762111 |
description | 两行代码实现腾讯云短信发送 |
homepage | |
repository | https://github.com/BaLaLaLs/simple-tencent-sms |
max_upload_size | |
id | 1436061 |
size | 12,103 |
cargo add simple-tencent-sms
secret 获取相关可查看腾讯云官网文档
let tencent_sms = TencentSMS::new(
"secret_id".into(),
"secret_key".into(),
"sms_app_id".into(),
);
let response_json = tencent_sms
.send_sms(
Region::Beijing,
"sign_name".into(),
vec!["+86xxxxxxx"],
"template_id".into(),
vec!["xxxx"],
)
.await?;
response 和官方文档返回json一致
{
"Response": {
"SendStatusSet": [
{
"SerialNo": "5000:1045710669157053657849499619",
"PhoneNumber": "+8618501234444",
"Fee": 1,
"SessionContext": "outsid_1729495320_1011",
"Code": "Ok",
"Message": "send success",
"IsoCode": "CN"
}
],
"RequestId": "a0aabda6-cf91-4f3e-a81f-9198114a2279"
}
}