pub struct SlackClient { /* private fields */ }Expand description
Simple Slack client
token: your Slack bot token (e.g. “xoxb-xxxx-….”)http_client: a Reqwest Client for making API calls
Implementations§
Source§impl SlackClient
impl SlackClient
Sourcepub async fn post_message(
&self,
channel: &str,
text: &str,
blocks: Option<Value>,
) -> Result<SlackPostMessageResponse, Error>
pub async fn post_message( &self, channel: &str, text: &str, blocks: Option<Value>, ) -> Result<SlackPostMessageResponse, Error>
Posts a message (with optional blocks) to a channel.
channel: channel ID or name (e.g. “#general” or “C12345”)text: fallback text for notifications, loggers, etc.blocks: optional JSON array of Block Kit blocks
Returns the Slack API response or an error.
Sourcepub async fn post_ephemeral(
&self,
channel: &str,
user_id: &str,
text: &str,
blocks: Option<Value>,
) -> Result<SlackEphemeralResponse, Error>
pub async fn post_ephemeral( &self, channel: &str, user_id: &str, text: &str, blocks: Option<Value>, ) -> Result<SlackEphemeralResponse, Error>
Posts an ephemeral message in a channel, visible only to user_id.
channel: The channel to post inuser_id: The user who will see the ephemeral messagetext: fallback textblocks: optional JSON array of Block Kit blocks
Returns the Slack API response or an error.
Sourcepub async fn open_modal(
&self,
trigger_id: &str,
view: Value,
) -> Result<SlackViewOpenResponse, Error>
pub async fn open_modal( &self, trigger_id: &str, view: Value, ) -> Result<SlackViewOpenResponse, Error>
Opens a modal (View) in Slack.
NOTE: The trigger_id comes from interactive payloads or slash commands.
trigger_id: Provided by Slack when a user invokes an action (e.g. button click)view: a JSON object describing the modal’s structure
Returns the Slack API response or an error.
Auto Trait Implementations§
impl Freeze for SlackClient
impl !RefUnwindSafe for SlackClient
impl Send for SlackClient
impl Sync for SlackClient
impl Unpin for SlackClient
impl !UnwindSafe for SlackClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more