We can improve our personal branding is creating content and by posting to social media consistently. In this article, I am creating an Azure Serverless function, which helps to fetch news articles using Azure Cognitive Services — Bing News API and post content to Twitter. I am also using Azure Text Analytics service, which will extract key phrases from the news title — which helps to tag the tweets.
Here is the flow diagram for the application.
In the application, users can configure a set of predefined topics. The function will search for news based on the configured topics randomly. And upon receiving the results — again takes random one and extract the key phrases using Azure Cognitive Services — Text Analytics service — which used as tags in the Tweet.
Next using Bit.ly API, we will shorten the URL and add UTM parameters which can be used to track analytics via Google Analytics.
And finally, we will build tweet using news name, tags and short URL. To publish the tweet we are using Tweetinvi nuget package — this will post the tweet using twitter application credentials.
Here is the code snippet which will search for random topics using Azure Bing Search API.
And here is the code which will extract the key phrases using Azure Cognitive Service — Text Analytics API — and convert the keywords to hashtags.
Here is the code to create a short URL using https://bit.ly API.
And finally the Azure Serverless function — which will orchestrate the function invocations.
This function will trigger on scheduled intervals, fetch content, create tweet using keyword and links. And finally posting using TweetInvi C# code. Here is an example of a tweet — pushed via this azure function.
We can improve this bot by choosing the best suited time for posting in social media and scheduling it based on that. Also, we can add some sentiment analysis around the tweets and improve the quality of tweets.