Skip to content

Commit

Permalink
use reqwest for post to Slack
Browse files Browse the repository at this point in the history
  • Loading branch information
sksat committed Oct 30, 2024
1 parent cd027dc commit aa06022
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/slack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@ impl Message {
};

// post
let r = surf::post("https://slack.com/api/chat.postMessage")
.header(
surf::http::headers::AUTHORIZATION,
format!("Bearer {}", &token),
)
.body_json(&payload)
.expect("post json")
.recv_string()
let client = reqwest::Client::new();
let r = client
.post("https://slack.com/api/chat.postMessage")
.bearer_auth(token)
.json(&payload)
.send()
.await;

debug!("{:?}", &r);
Expand Down

0 comments on commit aa06022

Please sign in to comment.