Link Shortening

Using shortened links and tag actions.

Airship can shorten links in your SMS messages, saving valuable characters for your message and helping you track engagement with your SMS messages. When you enable link shortening, Airship replaces your URL with unique, shortened URLs for each member of your audience.

Shortened URLs:

  • Reduce the total number of characters in your messages — Shortened links using the default airsp.co and airsp.eu domains consume exactly 25 characters.

  • Track engagement with SMS messages — Airship generates short_link_click events in the Real-Time Data StreamingA service that delivers engagement events in real time via the Data Streaming API or an Airship partner integration. (RTDS), and generates engagement reports based on short-link usage to help you track the effectiveness of your messages and engagement down to individual audience members.

  • Support adding or removing tags from your audience when they tap or click a link by adding query parameters to your URL — ?ua-tag-add=tag_group:tag or ?ua-tag-remove=tag_group:tag.

  • Expire 60 days after they are sent.

For Airship to recognize and shorten your links, your URLs must:

  • Begin with http:// or https://.
  • Begin and end with a space. Your URL cannot contain beginning or trailing punctuation or space characters; spaces determine the beginning and end of the URL.

You can use custom domains for your shorten links, e.g., mysite.co, or use the default airsp.co or airsp.eu domains. Contact Airship Support if you want to use a custom domain for shortened links. To support a custom domain, you must configure your web server appropriately.

 Note

You may not want to use shortened links for static, easily recognizable URLs, e.g, links to your terms and conditions. If you want to use a persistent shortened link like https://example.com/help, you must provide the URL yourself. You can enable or disable link shortening whenever you send a message using the Airship dashboard.

In the dashboard, you enable link shortening in the Content step in a composer:

You can also set your project to automatically shorten links in all messages created using the dashboard: Go to Settings » Project Configuration and click Manage for Dashboard Settings, then enable SMS Link Shortening.

 Note

Your project’s link shortening setting does not affect operations in the API.

Using the API, add "shorten_links": true to your payload. See the SMS Object for more information.

POST /api/templates/push HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json

{
   "audience": {
   "named_user": "user"
   },
   "notification": {
   "sms": {
      "alert": "An alert with a link for SMS users https://www.mysite.com/long_url?ua-tag-add=my_tag_group:cool_tag",
      "expiry": 172800,
      "shorten_links": true
   }
   },
   "device_types": [ "sms" ]
}

Tag Actions with Shortened Links

You can add or remove tags from users who engage with Airship-shortened links in your SMS messages. Shortened links with tag actions are the same length as URLs without. You can also use tag change events to kick off automation rules or sequences, making it easier to integrate SMS messaging campaigns into your larger messaging strategy. You can perform up to 100 total tag actions (add and remove) per SMS message.

In the dashboard, a Set tags button appears when you add a URL in your SMS text (or SMS fallback text) and enable link shortening. Tag actions add query parameters to your URL, but users will still see the shortened URL in your SMS messages.

Using the API, you add query parameters to your URLs:

  • Add a tag: ?ua-tag-add=my_tag_group:tag_to_add
  • Remove a tag: ?ua-tag-remove=my_tag_group:tag_to_remove

The following payload is a simple example in which Airship would apply the blazers tag and remove the no_preference tag in the fav_team tag group for anybody who engages with the link.

Add and Remove a tag in an SMS Notification
POST /api/push HTTP/1.1
Authorization: Basic <master authorization string>
Accept: application/vnd.urbanairship+json; version=3
Content-Type: application/json

{
   "audience": {
      "AND": [
         {
            "tag": "basketball",
            "group": "interests"
         },
         {
            "tag": "portland",
            "group" "metro_area"
         }
      ]
   },
   "notification": {
      "sms": {
         "alert": "Vote for the Blazers as your favorite team! https://www.mysite.com/long_url?ua-tag-add=fav_team:blazers&ua-tag-remove=fav_team:no_preference",
         "expiry": 172800,
         "shorten_links": true
      }
   },
   "device_types": [ "sms" ]
}