linkbot

A Discord bot and HTTP API that sanitizes URLs.

HTTP API

POST a URL and get a sanitized version back. Music links (Spotify, Apple Music, YouTube Music, Tidal, Deezer, etc.) are resolved through Odesli to a universal song.link page.

POST /sanitize

curl -X POST https://this-host/sanitize \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://open.spotify.com/track/1jJci4qxiYcOHhQR247rEU"}'

Returns:

{
  "url": "https://open.spotify.com/track/1jJci4qxiYcOHhQR247rEU",
  "sanitized": "https://song.link/s/1jJci4qxiYcOHhQR247rEU",
  "changed": true
}

GET /healthcheck — liveness probe, returns {"status":"ok"}.

Discord bot

The bot watches messages, finds music links, and replies with the song.link version so people on different streaming services can still open them. It will not reply if the sanitized URL is already in the source message or in the recent channel history.

When DISCORD_CLIENT_ID and DISCORD_CLIENT_SECRET are both set, linkbot also registers a global /sanitize slash command at startup so users can sanitize a URL on demand.

Add linkbot to your server

Requires the Send Messages and Read Message History permissions, plus the Message Content privileged intent on the application.

Source

github.com/icco/linkbot