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

Update DOTD Slack Integration #42397

Merged
merged 10 commits into from Oct 12, 2021
Merged

Conversation

KatieShipley
Copy link
Contributor

@KatieShipley KatieShipley commented Sep 9, 2021

Our Slack API integration currently relies on legacy tokens, which have been deprecated in favor of Slack App (or Bot) tokens. While existing legacy tokens continue to work for now, new tokens are no longer being issued, which has resulted in engineers having to share personal tokens around with new hires. Legacy tokens will likely be removed entirely in a future Slack update, so let's get ahead of that and switch our Slack API calls to use a new Bot token that can be properly shared!

A few notes:

  • Legacy tokens could be passed as a query param to the Slack API. This is not the case with Bot tokens, which must be passed in the request's authorization header, so every function that makes Slack calls had to be updated to do so.
  • We were using the hidden chat.command endpoint, which was not updated to accept Bot tokens. Since this was only being used in the ci_build script to set a /reminder for the DOTD, I replaced the command function with a remind function that utilizes the chat.scheduleMessage endpoint to send a DM from the bot to a given user at a given time.
  • We also have a message function that is widely used across the codebase. This function utilizes an incoming webhook to send messages to various channels in Slack, and never used the legacy token to do so. I opted to leave this function untouched.

Links

Context: Slack thread
Jira ticket: FND-1699
More info: doc

Testing story

Existing Slack tests have been updated accordingly

Deployment strategy & follow-up

Once deployed, automated processes that post to Slack (using anything other than Slack.message) will need to do so using the new Bot token. The locals.yml of all servers currently using a legacy token will need to be updated to use the new token.

Once individual engineers pull this change locally, they should update their own locals.yml to use the new bot token before running the DOTD script.

@KatieShipley KatieShipley force-pushed the katie/dotd-slack-integration branch 2 times, most recently from 86e2d27 to 3b6442d Compare October 8, 2021 17:17
…dule a reminder for the DOTD to check Zendesk in 2 hours) and utilize chat.shceduleMessage instead.
…on't need to try to add the user to these channels anymore
…legacy slack_token. The Slack integration will prefer the slack_bot_token if available, but can fall back to the slack_token and send a warning to Honeybadger that a legacy token is still being used somewhere. Also add Honeybadger logging if the calls to Slack fail for any reason.
…loy. Change Zendesk link to point to the 'All Open Tickets' filter.
@KatieShipley KatieShipley merged commit eac63bc into staging Oct 12, 2021
@KatieShipley KatieShipley deleted the katie/dotd-slack-integration branch October 12, 2021 01:59
@breville
Copy link
Member

Great write-up!

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.

None yet

2 participants