Tutorials

Connect Your Self-Hosted Shlink URL Shortener to Your Social Media Posts

Taras Shynkarenko
•Updated: •6 min read
Connect Your Self-Hosted Shlink URL Shortener to Your Social Media PostsConnect Your Self-Hosted Shlink URL Shortener to Your Social Media Posts

TL;DR, Quick Answer

6 min read

AdaptlyPost connects to a self-hosted Shlink server and shortens the links in your posts as they publish. A workspace admin enters the server's public HTTPS address and an API key from shlink api-key:generate on the Integrations page (Link shortener tab), then picks one of the server's domains. Choose shorten all links, shorten the main link only, or don't shorten, as a default, per platform or per account. AdaptlyPost calls Shlink's REST API v3, reuses the existing short URL for a link it has shortened before, shortens up to 25 links per post, skips TikTok, and publishes the original links if the server doesn't answer. Included in every plan.

A self-hosted Shlink URL shortener can shorten every link in your social posts once it's connected to AdaptlyPost: at publish time, AdaptlyPost sends each URL to your Shlink server and posts the short link it gets back. The links, the click data and the domain all stay on a server you run.

Shlink is the open-source shortener people pick when they don't want click data on someone else's servers, or when they already run it for email and print. What it never had was a way to reach scheduled social posts without a person pasting links into it. That's the gap this integration closes.

The short version: run shlink api-key:generate on your server, open Integrations in AdaptlyPost, choose the Link shortener tab and Shlink, enter the server address and key, pick a domain, then choose which links to shorten.

The Shlink integration turns the links in your posts into short URLs on your Shlink server at the moment each post publishes. It works on every network AdaptlyPost posts to except TikTok, for posts made in the composer, the API, Zapier, n8n or an AI agent.

You write the full URL in the post. The composer preview and the calendar keep showing it, and the short link only exists on the published post. If you edit the URL up to the last minute, Shlink gets whatever is in the post at publish time.

You need a Shlink server reachable from the internet over HTTPS, an API key from that server, at least one domain set on it, and the Admin role in your AdaptlyPost workspace. AdaptlyPost talks to Shlink's REST API v3, which Shlink 3.0 and later serve.

  • A public HTTPS address, such as https://s.example.com. AdaptlyPost's servers make the calls, so a server reachable only on your office network or over a VPN won't connect.
  • An API key. Run shlink api-key:generate on the server, or in its Docker container, and copy the key it prints.
  • A domain. Shlink lists its default domain and any extra domains you added. A server with no domain set refuses the connection.

A person types commands on a laptop, the kind of step needed to create an API key on your own server.

You connect Shlink from AdaptlyPost's Integrations page: open the Link shortener tab, choose Shlink, enter the server address and the API key, check the connection, and pick the domain your short links use.

  1. Open the Link shortener tab under Integrations and choose Shlink.
  2. Enter the Shlink server address, for example https://s.example.com. The address of the REST API, ending in /rest/v3, works too.
  3. Paste the Shlink API key and click Check connection. AdaptlyPost asks your server for its domains with that key.
  4. Pick a short link domain from the list your server returns.
  5. Click Connect Shlink and choose the default for which links get shortened.

The error messages say which part failed. "Your Shlink server did not accept this API key" means a new key is needed. "No Shlink server answered at this address" means the address is wrong or the server isn't reachable over HTTPS from outside. A workspace connects one shortener, so switching from Switchy to Shlink means disconnecting Switchy first.

AdaptlyPost shortens every link or only the main link, depending on the mode. Shorten all links covers every URL in the text and the first comment, plus Pinterest destination links and Google Business Profile button and offer links. Shorten the main link only covers the first URL in the text, or the destination link on Pinterest and Google Business Profile.

SettingWhere you change itWho it applies to
Default for all platformsLink shortener tabEvery account, including ones connected later
By platformLink shortener tabAll accounts on one network
Per accountLink icon next to the account on ConnectorsOne account

The most specific setting wins. Links already on your Shlink domain stay as they are, and so does anything that isn't a public http or https URL. A post with more than 25 links shortens the first 25.

AdaptlyPost doesn't create duplicates: it asks Shlink to return the existing short URL when one already exists for the same long URL and domain, and it remembers every link it shortened for your workspace. A product URL posted every week keeps one short link and one click count.

That matters more with Shlink than with hosted shorteners, because every new short URL is a row in your own database. A recurring weekly post through AdaptlyPost's content calendar or an RSS feed reusing the same homepage link adds nothing new to Shlink after the first time.

A technician checks equipment in a server rack, the sort of maintenance that can take a self-hosted link shortener offline for a while.

The post publishes on time with its original links. AdaptlyPost waits 10 seconds for each answer from your server, retries a failed link twice, and then skips shortening for that post rather than delaying it.

So a Shlink upgrade at 9:00 on a Monday doesn't hold back the posts scheduled for 9:00. They go out with full URLs, and the next posts after the server is back get short links again. If you track clicks with UTM tags in the long URL, those still work in that case; the social media traffic guide shows how to set them up.

What publishes when Shlink answers, and when it doesn't
Server answers
  • AdaptlyPost sends each URL to Shlink at publish time
  • Shlink returns the short link
  • The published post carries the short link
Server doesn't answer
  • AdaptlyPost waits 10 seconds for each answer
  • It retries a failed link twice
  • The post publishes on time with its original links
An outage costs you the short links on that post, and the post still goes out.

Use Shlink when you want the short links and click data on your own server and someone on the team can run it; use Switchy when you want a hosted service with nothing to maintain. Both connect in the same Link shortener tab and shorten links the same way.

ShlinkSwitchy
HostingYour own serverSwitchy's servers
ConnectionServer address and API keyAPI key
DomainsAny domain set on your serverCustom domains in your Switchy workspace and Switchy's shared domains
Click dataIn your Shlink serverIn Switchy

The Switchy link guide covers the hosted option. For bios rather than posts, the link in bio guide covers the other place short links usually end up.

The Shlink integration can't shorten links on TikTok, change links on posts that already published, set custom slugs or tags in Shlink, or show Shlink's visit counts inside AdaptlyPost. Visits stay in Shlink, readable in its web client or API.

Disconnecting Shlink stops shortening for new posts. Short URLs already on your server keep redirecting, because AdaptlyPost never deletes them.

Frequently Asked Questions

Shlink is an open-source, self-hosted URL shortener with a REST API and visit tracking. AdaptlyPost connects to it through that REST API to shorten the links in social posts.

Run shlink api-key:generate on the Shlink server, or inside its Docker container, and copy the key it prints. Paste it into the Shlink API key field on AdaptlyPost's Link shortener tab.

Your Shlink server needs a public HTTPS address, because AdaptlyPost's servers call its REST API when a post publishes. A server reachable only on a private network or VPN can't connect.

AdaptlyPost uses Shlink's REST API v3, which Shlink 3.0 and later serve. You can enter either the server address or the full REST address ending in /rest/v3.

AdaptlyPost lists every domain on your Shlink server, the default one and any extra domains you added, and you pick one when you connect. You can change the domain later on the same tab.

The Shlink integration comes with every AdaptlyPost plan, starting at $19 a month for Creator with a 7-day free trial. Shlink itself is free and open source; you pay only for the server it runs on.

AdaptlyPost skips TikTok when it shortens links. The integration works on every other network AdaptlyPost posts to, including for posts made through the API, Zapier, n8n or an AI agent.

Visit counts stay in your Shlink server, where you can read them in its web client or API. AdaptlyPost doesn't show them.

Short URLs already on your server keep redirecting, because AdaptlyPost never deletes them. Disconnecting only stops shortening for new posts.

Use the link icon next to the account to set it to don't shorten. You can also set the rule for a whole platform or as a default for all platforms, and the most specific setting wins.

Was This Article Helpful?

Let us know what you think!

See us more often in Google

One click marks AdaptlyPost as a preferred source, so our articles sit higher in your Top Stories, AI Mode, and AI Overviews.

Related Articles