Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Supported way to use slackblocks with WebhookClient #68

Closed
rileydakota opened this issue Feb 8, 2024 · 3 comments · Fixed by #70
Closed

Question: Supported way to use slackblocks with WebhookClient #68

rileydakota opened this issue Feb 8, 2024 · 3 comments · Fixed by #70

Comments

@rileydakota
Copy link

Hello!

We have a few slack apps that rely on app based incoming webhooks. We utilize the WebhookClient class in the SDK to interface with this. It doesn't require a few of the fields, like channel or text. Is there a supported way to pass the blocks in (aside from dropping them into a Message instance and grabbing the blocks from that?)

@nicklambourne
Copy link
Owner

There isn't currently, but I'd be open to making something like a WebhookMessage class with just those required fields. Would that suit your use case? (Also happy to take other suggestions on board).

@rileydakota
Copy link
Author

rileydakota commented Feb 9, 2024

Yeah - I'd be cool with that. My current solution (not pretty) just has been:

msg = Message(channel='None', blocks=[SectionBlock(), ...]
webhook_client = WebhookClient(slack_webhook)

response = webhook_client.send(blocks=msg['blocks'])

Having a WebhookMessage class seems more elegant to me.

@nicklambourne nicklambourne linked a pull request Feb 11, 2024 that will close this issue
@nicklambourne
Copy link
Owner

Added in #70 / v1.0.3, let me know if anything is broken / can be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants