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

Class LinkButtonElement

slack_sdk/models/blocks/block_elements.py:268–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266
267
268class LinkButtonElement(ButtonElement):
269 def __init__(
270 self,
271 *,
272 text: Union[str, dict, PlainTextObject],
273 url: str,
274 action_id: Optional[str] = None,
275 style: Optional[str] = None,
276 **others: dict,
277 ):
278 """A simple button that simply opens a given URL. You will still receive an
279 interaction payload and will need to send an acknowledgement response.
280 This is a helper class that makes creating links simpler.
281 https://docs.slack.dev/reference/block-kit/block-elements/button-element/
282
283 Args:
284 text (required): A text object that defines the button's text.
285 Can only be of type: plain_text.
286 Maximum length for the text in this field is 75 characters.
287 url (required): A URL to load in the user's browser when the button is clicked.
288 Maximum length for this field is 3000 characters.
289 If you're using url, you'll still receive an interaction payload
290 and will need to send an acknowledgement response.
291 action_id (required): An identifier for this action.
292 You can use this when you receive an interaction payload to identify the source of the action.
293 Should be unique among all other action_ids in the containing block.
294 Maximum length for this field is 255 characters.
295 style: Decorates buttons with alternative visual color schemes. Use this option with restraint.
296 "primary" gives buttons a green outline and text, ideal for affirmation or confirmation actions.
297 "primary" should only be used for one button within a set.
298 "danger" gives buttons a red outline and text, and should be used when the action is destructive.
299 Use "danger" even more sparingly than "primary".
300 If you don't include this field, the default button style will be used.
301 """
302 super().__init__(
303 # NOTE: value must be always absent
304 text=text,
305 url=url,
306 action_id=action_id,
307 value=None,
308 style=style,
309 )
310 show_unknown_key_warning(self, others)
311
312
313# -------------------------------------------------

Callers 12

test_document_3Method · 0.90
test_jsonMethod · 0.90
test_url_lengthMethod · 0.90
test_action_id_lengthMethod · 0.90
test_jsonMethod · 0.90
test_jsonMethod · 0.90
test_document_3Method · 0.90
test_jsonMethod · 0.90
test_url_lengthMethod · 0.90
test_jsonMethod · 0.90
test_jsonMethod · 0.90

Calls

no outgoing calls

Tested by 12

test_document_3Method · 0.72
test_jsonMethod · 0.72
test_url_lengthMethod · 0.72
test_action_id_lengthMethod · 0.72
test_jsonMethod · 0.72
test_jsonMethod · 0.72
test_document_3Method · 0.72
test_jsonMethod · 0.72
test_url_lengthMethod · 0.72
test_jsonMethod · 0.72
test_jsonMethod · 0.72