- Create a new function by choosing the GenericWebHook-C# trigger and name it ValidateTwitterFollowerCount.
- Replace the default code with the following:
#r "Newtonsoft.Json" #r "SendGrid" using System; using System.Net; using Newtonsoft.Json; using SendGrid.Helpers.Mail; public static void Run(HttpRequestMessage req, TraceWriter log, out Mail message ) { log.Info($"Webhook was triggered!"); string jsonContent = req.Content.ReadAsStringAsync().Result; dynamic data = JsonConvert.DeserializeObject<dynamic> (jsonContent); string strTweet = ""; if(data.followersCount >= 200) { strTweet = "Tweet Content" + data.tweettext; message = new Mail(); message.Subject = $"{data.Name} with {data.followersCount} followers has posted a tweet"; ...