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

feat(slack): add bot API support #179

Merged
merged 7 commits into from
Jul 27, 2021
Merged

feat(slack): add bot API support #179

merged 7 commits into from
Jul 27, 2021

Conversation

piksel
Copy link
Member

@piksel piksel commented Jul 3, 2021

This adds support for sending slack messages using the bot API instead of using a webhook.
It also enables the icon_ props from #173 as they are fully supported by the API.
The documentation would need to be updated with information about the differences between the tokens (and what fields doesn't work work with (non-legacy) webhooks).
This also changes the slack service URL (with backwards compatible parser) to account for the new token types:

Bot API:

xoxb-123456789012-1234567890123-4mt0t4l1YL3g1T5L4cK70k3N
=>
slack://xoxb:123456789012-1234567890123-4mt0t4l1YL3g1T5L4cK70k3N@CHANNEL

Webhook:

https://hooks.slack.com/services/WNA3PBYV6/F20DUQND3RQ/Webc4MAvoacrpPakR8phF0zi
=>
slack://hook:WNA3PBYV6-F20DUQND3RQ-Webc4MAvoacrpPakR8phF0zi@webhook

This was also done in order to easier remove credentials from configuration URLs. The goal for v1.0 is to have all credentials (where practical) in the password part of the URLs.

@codecov
Copy link

codecov bot commented Jul 3, 2021

Codecov Report

Merging #179 (cc5bb51) into main (5d12d75) will increase coverage by 0.41%.
The diff coverage is 84.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #179      +/-   ##
==========================================
+ Coverage   63.65%   64.06%   +0.41%     
==========================================
  Files          86       86              
  Lines        2713     2758      +45     
==========================================
+ Hits         1727     1767      +40     
- Misses        836      839       +3     
- Partials      150      152       +2     
Impacted Files Coverage Δ
pkg/services/slack/slack.go 75.55% <75.67%> (+10.33%) ⬆️
pkg/services/slack/slack_token.go 82.05% <81.57%> (-6.42%) ⬇️
pkg/services/slack/slack_config.go 100.00% <100.00%> (+7.40%) ⬆️
pkg/services/slack/slack_json.go 100.00% <100.00%> (ø)
pkg/util/generator/generator_common.go 80.26% <100.00%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d12d75...cc5bb51. Read the comment docs.

# Conflicts:
#	pkg/services/slack/slack_config.go
#	pkg/services/slack/slack_json.go
@piksel piksel marked this pull request as ready for review July 27, 2021 09:39
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 this pull request may close these issues.

1 participant