4

I am trying to schedule an SMS in the journey to the subscribers who did not open their email. I want to redirect the subscribers to their hosted email page.

I am using the below code to populate hosted email link in email.

%%=RedirectTo(CloudPagesURL(383,'Id',@Id))=%%

In the message, it's showing up.

http://pub.s7.exacttarget.com/lurat1d1uu?qs=0adsffa7913f3b66e20e907542d34985a0314e14bda6c724a7fe5260c80158a814d04cc002dbbfdf1c5

How can I shorten this URL?

1 Answer 1

8

That's a great question. We've tried using the bit.ly shorten API method in conjunction with an AMPscript HTTPGet function (to make a request to the API) to shorten a URL. This works well, but the problem was that we quickly hit a rate limiting issue where we started receiving a 403 HTTP Status codes back from bit.ly.

It turns out that bit.ly has a monthly rate limit of 5,000 links created and an hourly limit of 1,000 and a 100 in a minute. This is for the free usage edition. We looked into their paid plans and the cost was going to be pretty expensive (~$850 per month), so we ended up building our own API.

So, depending on how many SMS messages you want to send, the bit.ly API could be an option. If bit.ly is an option for you, here's some code that should work:

var @Id, @shortenUrl, @bitlyUrl, @link
set @Id = AttributeValue('Id')
set @link = URLEncode(CloudPagesURL(383,'Id',@Id))
set @bitlyUrl = 'https://api-ssl.bitly.com/v3/shorten?access_token=ACCESS_TOKEN&longUrl='
set @shortenUrl = HTTPGet(Concat(@bitlyUrl,@link,"&format=txt"))

Note that you obtain the ACCESS_TOKEN from your bit.ly account but it's persistent and doesn't expire, so you don't need to generate a new one each time.

11
  • Thanks for your help Eliot. Is there any other service we can use except bit.ly?
    – Mohammed
    Commented Feb 24, 2017 at 4:20
  • @Mohammed, you can use any service you want. I haven't done an extensive search, however it looks like thelink.la does not have rate limiting. You can also install and host your own on a web server like yourls.org, Commented Feb 24, 2017 at 4:58
  • If I have answered your question, please accept it for the benefit of others. Commented Feb 24, 2017 at 5:03
  • No problem @Mohammed. If I have answered your question, please accept it (click on the tick icon). Commented Feb 27, 2017 at 2:46
  • Hi @EliotHarper - I have used this method to shorten a one click unsubscribe link included in my SMS message. I have noticed that the AMPScript on my page gets executed the moment bit.ly shortens the link. As a result all my contacts are getting automatically unsubscribed. Is there a way to prevent this from happening ?
    – Vic
    Commented Oct 3, 2018 at 14:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .