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.
bit.ly
before the HTTPGet(). Here's an example of getting an access token with AMPScript: salesforce.stackexchange.com/a/171165/5202