MCPcopy Create free account
hub / github.com/slackapi/python-slack-sdk / send

Method send

slack_sdk/webhook/async_client.py:88–134  ·  view source on GitHub ↗

Performs a Slack API request and returns the result. Args: text: The text message (even when having blocks, setting this as well is recommended as it works as fallback) attachments: A collection of attachments blocks: A collection of Block Kit UI componen

(
        self,
        *,
        text: Optional[str] = None,
        attachments: Optional[Sequence[Union[Dict[str, Any], Attachment]]] = None,
        blocks: Optional[Sequence[Union[Dict[str, Any], Block]]] = None,
        response_type: Optional[str] = None,
        replace_original: Optional[bool] = None,
        delete_original: Optional[bool] = None,
        unfurl_links: Optional[bool] = None,
        unfurl_media: Optional[bool] = None,
        metadata: Optional[Dict[str, Any]] = None,
        headers: Optional[Dict[str, str]] = None,
    )

Source from the content-addressed store, hash-verified

86 self.proxy = env_variable
87
88 async def send(
89 self,
90 *,
91 text: Optional[str] = None,
92 attachments: Optional[Sequence[Union[Dict[str, Any], Attachment]]] = None,
93 blocks: Optional[Sequence[Union[Dict[str, Any], Block]]] = None,
94 response_type: Optional[str] = None,
95 replace_original: Optional[bool] = None,
96 delete_original: Optional[bool] = None,
97 unfurl_links: Optional[bool] = None,
98 unfurl_media: Optional[bool] = None,
99 metadata: Optional[Dict[str, Any]] = None,
100 headers: Optional[Dict[str, str]] = None,
101 ) -> WebhookResponse:
102 """Performs a Slack API request and returns the result.
103
104 Args:
105 text: The text message (even when having blocks, setting this as well is recommended as it works as fallback)
106 attachments: A collection of attachments
107 blocks: A collection of Block Kit UI components
108 response_type: The type of message (either 'in_channel' or 'ephemeral')
109 replace_original: True if you use this option for response_url requests
110 delete_original: True if you use this option for response_url requests
111 unfurl_links: Option to indicate whether text url should unfurl
112 unfurl_media: Option to indicate whether media url should unfurl
113 metadata: Metadata attached to the message
114 headers: Request headers to append only for this request
115
116 Returns:
117 Webhook response
118 """
119 return await self.send_dict(
120 # It's fine to have None value elements here
121 # because _build_body() filters them out when constructing the actual body data
122 body={
123 "text": text,
124 "attachments": attachments,
125 "blocks": blocks,
126 "response_type": response_type,
127 "replace_original": replace_original,
128 "delete_original": delete_original,
129 "unfurl_links": unfurl_links,
130 "unfurl_media": unfurl_media,
131 "metadata": metadata,
132 },
133 headers=headers,
134 )
135
136 async def send_dict(self, body: Dict[str, Any], headers: Optional[Dict[str, str]] = None) -> WebhookResponse:
137 """Performs a Slack API request and returns the result.

Callers

nothing calls this directly

Calls 1

send_dictMethod · 0.95

Tested by

no test coverage detected