-
-
Save eduardobatistadev/ced0ee33fd56592cf7c40857011e1922 to your computer and use it in GitHub Desktop.
Create Dynamic links using Bit.ly API in Marketing Cloud SMS Send, with AMPScript and Guide Template Language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ampscript - Integracao com bitly que encurta URL dinamicamente enviada por SMS. | |
%%[ | |
var @cloudpage, @link, @param, @bitlyPage, @contentType, @content, | |
@bitlyToken, @additionalHeaderName, @additionalHeaderValue, @request, @response, | |
@message | |
set @bitlyToken = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX' // Your bitly Token | |
set @bitlyPage = 'https://api-ssl.bitly.com/v4/bitlinks' | |
set @contentType = 'application/json' | |
set @additionalHeaderName = 'Authorization' | |
set @additionalHeaderValue = concat('Bearer ', @bitlyToken) | |
set @param = AttributeValue('Id'); // Or Any Attribute | |
set @cloudpage = 'https://yourdomain.com/something' | |
set @link = concat(@cloudpage, '?yourparam=', @param) | |
set @content = concat('{"long_url": "',@link,'"}') | |
set @request = HTTPPost(@bitlyPage, @contentType, @content, @response, | |
@additionalHeaderName, @additionalHeaderValue) | |
set @message = 'Hello, this is my link :' | |
]%%%%=v(@message)=%%{{.datasource response type=variable}}{{.data}}{ "target" : "@response" }{{/data}}{{link}}{{/datasource}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment