MCPcopy Index your code
hub / github.com/slackapi/python-slack-sdk / send

Method send

slack/webhook/async_client.py:39–67  ·  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[List[Union[Dict[str, any], Attachment]]] = None,
        blocks: Optional[List[Union[Dict[str, any], Block]]] = None,
        response_type: Optional[str] = None,
        headers: Optional[Dict[str, str]] = None,
    )

Source from the content-addressed store, hash-verified

37 self.default_headers = default_headers if default_headers else {}
38
39 async def send(
40 self,
41 *,
42 text: Optional[str] = None,
43 attachments: Optional[List[Union[Dict[str, any], Attachment]]] = None,
44 blocks: Optional[List[Union[Dict[str, any], Block]]] = None,
45 response_type: Optional[str] = None,
46 headers: Optional[Dict[str, str]] = None,
47 ) -> WebhookResponse:
48 """Performs a Slack API request and returns the result.
49
50 Args:
51 text: The text message (even when having blocks, setting this as well is recommended as it works as fallback)
52 attachments: A collection of attachments
53 blocks: A collection of Block Kit UI components
54 response_type: The type of message (either 'in_channel' or 'ephemeral')
55 headers: Request headers to append only for this request
56 Returns:
57 Webhook response
58 """
59 return await self.send_dict(
60 body={
61 "text": text,
62 "attachments": attachments,
63 "blocks": blocks,
64 "response_type": response_type,
65 },
66 headers=headers,
67 )
68
69 async def send_dict(self, body: Dict[str, any], headers: Optional[Dict[str, str]] = None) -> WebhookResponse:
70 return await self._perform_http_request(

Callers 15

test_webhookMethod · 0.95
test_with_unfurls_offMethod · 0.95
test_with_unfurls_onMethod · 0.95
test_with_blocksMethod · 0.95
test_with_blocks_dictMethod · 0.95
test_with_attachmentsMethod · 0.95
test_metadataMethod · 0.95
test_sendMethod · 0.95
test_ratelimitedMethod · 0.95
test_sendMethod · 0.95
test_send_blocksMethod · 0.95

Calls 1

send_dictMethod · 0.95

Tested by 15

test_webhookMethod · 0.76
test_with_unfurls_offMethod · 0.76
test_with_unfurls_onMethod · 0.76
test_with_blocksMethod · 0.76
test_with_blocks_dictMethod · 0.76
test_with_attachmentsMethod · 0.76
test_metadataMethod · 0.76
test_sendMethod · 0.76
test_ratelimitedMethod · 0.76
test_sendMethod · 0.76
test_send_blocksMethod · 0.76