A Slack bot that automatically converts x.com and twitter.com links to xcancel.com links.
The following environment variables are required:
SLACK_BOT_TOKEN=xoxb-your-bot-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_APP_TOKEN=xapp-your-app-token
- Install dependencies:
npm install-
Create a
.envfile with the required environment variables -
Start the bot:
npm startThis bot is configured to deploy on Render. Required environment variables should be set in the Render dashboard.
If you're using Render's free tier, use something like uptimerobot.com to ping it and keep it awake.
-
Create a new Slack App at https://api.slack.com/apps
-
Under "OAuth & Permissions", add the following bot token scopes:
chat:write(to post messages)channels:history(to read messages in channels)groups:history(to read messages in private channels)im:history(to read direct messages)im:write(to send direct messages)
-
Under "Event Subscriptions", subscribe to the following bot events:
message.channels(to see messages in channels)message.groups(to see messages in private channels)message.im(to see direct messages)
-
Enable Socket Mode in your Slack App settings
-
Install the app to your workspace
-
Copy the following tokens from your Slack App settings:
- Bot User OAuth Token (starts with
xoxb-) - Signing Secret
- App-Level Token (create one with
connections:writescope if not exists)
- Bot User OAuth Token (starts with
-
Create a
.envfile in the project root and add your tokens:SLACK_BOT_TOKEN=xoxb-your-bot-token SLACK_SIGNING_SECRET=your-signing-secret SLACK_APP_TOKEN=xapp-your-app-token
For channels:
- Invite the bot using
/invite @xcancelin any channel (public or private) - Share any x.com or twitter.com links
For direct messages:
- Start a direct message with @xcancel
- Share any x.com or twitter.com links
The bot will automatically reply with the xcancel.com version of any x.com or twitter.com links shared.
- Automatically detects x.com and twitter.com URLs
- Supports multiple URLs in a single message
- Works in:
- Public channels (requires
/invite @xcancel) - Private channels (requires
/invite @xcancel) - Direct messages (just message @xcancel)
- Public channels (requires
- Supports both www and non-www URLs