Since Twitter no longer offers OGP and we can't see tweets when not logged in. So, use the Twitter API to expand the link on slack.
- Create a slack app
- Create a slack app
- Add the event subscriptions
- Open
Event Subscriptions
page (in side navigation) - Change Enable Events to On
- Subscribe to bot events
link_shared
- App unfurl domains
-
twitter.com
- Open
- Add the OAuth scopes
- Open
OAuth & Permissions
page (in side navigation) - Add the Bot Token Scopes (in Scopes Section)
links:read
links:write
links.embed:write
- Open
- Install app to workspace
- Open
Install App
page (in side navigation) - Click
Install to Workspace
button - Click
Allow
button - Copy
Bot User OAuth Access Token
- Open
- Deploy this app
- Clone this repository
- Create Queues
- Create a queue named
slack-twitter-unfurl
$ wrangler queues create slack-twitter-unfurl
- Create a queue named
- Set the Secret Variables
- Set the Secret Variables
$ wrangler secret put SLACK_BOT_TWITTER_UNFURL_TOKEN
SLACK_BOT_TWITTER_UNFURL_TOKEN
: Bot User OAuth Access Token (in 1.4.4)
- Set the Secret Variables
- Deploy
$ wrangler publish