When marketing website promotions or news to customers we typically send messages through appropriate channels such as email, LinkedIn or SMS messages. Usually these messages contain URL links to a website where more detailed information can be found on the promotion or news. These messages can contain URL links with more than 30 characters and having a long URL in a SMS message is not ideal when viewing on mobile devices.
A solution which we had added to the SMS Connector is to convert URL links within a SMS message to a short Bitly URL, this bitly URL opens the website once a user clicks on it.
Here are the steps required to convert a URL in Dynamics 365 to a Bitly URL:
1. Sign up for a free Bitly account at https://bitly.com/a/sign_up.
2. Navigate to the Settings area.
3. Click on your user icon to navigate to the Edit Profile area.
4. Click on Generic Access Token button to navigate to the Generic Access Token area.
5. Enter your password and click on Generate Token.
6. An access token will be generated, this token is required at the next step in order to generate the Bitly URL.
7. Create a HTTP GET request to the Bitly API endpoint.
8. The Bitly API endpoint will respond in the following HTT Response.
The body of the response will contain the Bitly converted URL.
The following is a C# method demonstrating how to generate a Bitly URL using standard .NET class and can be applied to Dynamics 365 plugins.