1

Referring to MC documentation I am trying to shorten a long URL using bitly. I have created an account in bitly and getting an API key from my personal account. But when I trigger the SMS, it did not get send out. I have no clue of the error.

%%[ 
VAR @URL, @longURL, @bitlyUrl, @msg
SET @URL = "example.com"
SET @msg = "Please click HERE" 
SET @longURL = CONCAT(@URL,"?id=",@subscriberKey)
SET @bitlyUrl = HTTPGet(Concat("https://api-ssl.bitly.com/v3/shorten?access_token=ACCESS_TOKEN&format=txt&longUrl=",@longURL))
SET @msg = Replace(@msg,"HERE", @bitlyUrl) 
]%% 
%%=v(@msg)=%%

The Ampscript works if I don't shorten the URL with bitly. What is wrong here?

Btw Is there any way to shorten URL in SMS in Marketing Cloud? this solution is also not working for me.

4
  • Use google shortner to create bitly link Commented Aug 11, 2017 at 8:59
  • @Rohit Mourya does Google Shortner support dynamic link? I can't seem to find the documentation in MC help page.
    – user44312
    Commented Aug 11, 2017 at 9:17
  • I guess so.. Once you've constructed your final URL send to google shortner API and you'll get a bitly link Commented Aug 11, 2017 at 9:34
  • 2
    You'll need to get an access token from bit.ly before the HTTPGet(). Here's an example of getting an access token with AMPScript: salesforce.stackexchange.com/a/171165/5202 Commented Aug 11, 2017 at 11:23

0

Browse other questions tagged .