Hi All,
i need code to do url shortning to send one of the sms campaign
Please help me how can i shorten that url
bityl url shortner to shorten url
please provide code/url ---how can we achieve that
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hello @jefrii
You can use this code to call bitly API
var req = new HttpClientRequest("https://api-ssl.bitly.com/v4/shorten")
req.header["Authorization"] = "Bearer TOKEN_HERE" ;
req.header["Content-Type"] = "application/json";
req.method = "POST";
req.body = '{ "group_guid": "GROUP_UUID_HERE","domain": "bit.ly","long_url": "LONG_URL_HERE"}' ;
try {
req.execute()
var response = req.response;
var res=JSON.parse(response.body);
return res.link;
}
catch(e)
{
return "unable to exceute api";
}
req.disconnect()
this is just a sample code to get you started
Hi @jefrii
I too had a similar use case where I used rebrandly as our 3rd party.
As I guess bitly is also an open source API, so you can create your account and keys to play around with the API projects. Once you are familiar with the body parameters which you need to send to bitly through an API call to get the shortened URL in response. You can create the same call in Adobe through JavaScript in a workflow and make the call to bitly to get the shortened URL in response after whitelisting the bitly URL in console.
Thanks,
Akshay
Hello @jefrii
You can use this code to call bitly API
var req = new HttpClientRequest("https://api-ssl.bitly.com/v4/shorten")
req.header["Authorization"] = "Bearer TOKEN_HERE" ;
req.header["Content-Type"] = "application/json";
req.method = "POST";
req.body = '{ "group_guid": "GROUP_UUID_HERE","domain": "bit.ly","long_url": "LONG_URL_HERE"}' ;
try {
req.execute()
var response = req.response;
var res=JSON.parse(response.body);
return res.link;
}
catch(e)
{
return "unable to exceute api";
}
req.disconnect()
this is just a sample code to get you started
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies