Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (23 sloc) 688 Bytes
function URLShortener() {
var body = {
"dynamicLinkInfo": {
"domainUriPrefix": "https://example.page.link",
"link": "https://example.com/?utm_source=email&utm_medium=mobile&utm_content=1234567890"
},
"suffix": {
"option": "SHORT"
}
};
var key = 'XXXXXXXXXXXXXXXXXXXXXXX'
var url = "https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=" + key;
var options = {
'method': 'POST',
"contentType": "application/json",
'payload': JSON.stringify(body),
};
var response = UrlFetchApp.fetch(url, options);
var json = response.getContentText();
var data = JSON.parse(json);
var obj = data["shortLink"];
Logger.log(obj)
}
You can’t perform that action at this time.