MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter 1.1.0

This extension provides the ability to activate a webjob based on twitter events

Install-Package MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter -Version 1.1.0
dotnet add package MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter --version 1.1.0
<PackageReference Include="MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter, 1.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter as a Cake Addin
#addin nuget:?package=MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter&version=1.1.0

// Install MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter as a Cake Tool
#tool nuget:?package=MonkeyShell.Microsoft.Azure.WebJobs.Extensions.Twitter&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Azure Function Twitter Trigger Extension

This repo contains a twitter based binding extension for <b>Azure WebJobs SDK</b> built on top of Tweetinvi and using the Twitter Stream API. Addittionally a simple sample <b>Azure Function</b> project demos how to use the trigger.

Note: I am still actively working on the features of what is here. Please provide feedback and open issues as you find them. I will happilly accept pull requests.

Configuration

In order to use this trigger you will need to sign up for a Twitter Developer Account and obtain your Consumer keys and generate Access keys. You then need to update your local.settings.json to contain the following:

"TwitterConsumerKey": "<API key>",
"TwitterConsumerSecret": "<API secret key>",
"TwitterAccessKey": "<Access token>",
"TwitterAccessSecret": "<Access token secret>"

TwitterTrigger

// Runs when a tweet containing the word "azure" is detected
public static async Task Run([TwitterTrigger("azure")]MatchedTweetReceivedEventArgs tweetEvent, ILogger log)
{
    log.LogInformation($"\n@{tweetEvent.Tweet.CreatedBy.ScreenName}[{tweetEvent.Tweet.CreatedBy.Name}]\n" +
        $"Tweeted: {tweetEvent.Tweet.FullText}\n" +
        $"HashTags: [{String.Join(",", tweetEvent.Tweet.Hashtags.Select(x => $"#{x.Text}"))}]");
}

// Runs when a tweet containing the hashtag "#azure" is detected
public static async Task Run([TwitterTrigger("#azure")]MatchedTweetReceivedEventArgs tweetEvent, ILogger log)
{
    log.LogInformation($"\n@{tweetEvent.Tweet.CreatedBy.ScreenName}[{tweetEvent.Tweet.CreatedBy.Name}]\n" +
        $"Tweeted: {tweetEvent.Tweet.FullText}\n" +
        $"HashTags: [{String.Join(",", tweetEvent.Tweet.Hashtags.Select(x => $"#{x.Text}"))}]");
}

// Runs when a tweet by @introtocs is detected
public static async Task Run([TwitterTrigger(user: "introtocs")]MatchedTweetReceivedEventArgs tweetEvent, ILogger log)
{
    log.LogInformation($"\n@{tweetEvent.Tweet.CreatedBy.ScreenName}[{tweetEvent.Tweet.CreatedBy.Name}]\n" +
        $"Tweeted: {tweetEvent.Tweet.FullText}\n" +
        $"HashTags: [{String.Join(",", tweetEvent.Tweet.Hashtags.Select(x => $"#{x.Text}"))}]");
}

// Runs when a tweet by @introtocs is detected containing the hashtag "#azure"
public static async Task Run([TwitterTrigger("#azure", "introtocs")]MatchedTweetReceivedEventArgs tweetEvent, ILogger log)
{
    log.LogInformation($"\n@{tweetEvent.Tweet.CreatedBy.ScreenName}[{tweetEvent.Tweet.CreatedBy.Name}]\n" +
        $"Tweeted: {tweetEvent.Tweet.FullText}\n" +
        $"HashTags: [{String.Join(",", tweetEvent.Tweet.Hashtags.Select(x => $"#{x.Text}"))}]");
}

License

This project is licensed under the MIT License

Azure Function Twitter Trigger Extension

This repo contains a twitter based binding extension for <b>Azure WebJobs SDK</b> built on top of Tweetinvi and using the Twitter Stream API. Addittionally a simple sample <b>Azure Function</b> project demos how to use the trigger.

Note: I am still actively working on the features of what is here. Please provide feedback and open issues as you find them. I will happilly accept pull requests.

Configuration

In order to use this trigger you will need to sign up for a Twitter Developer Account and obtain your Consumer keys and generate Access keys. You then need to update your local.settings.json to contain the following:

"TwitterConsumerKey": "<API key>",
"TwitterConsumerSecret": "<API secret key>",
"TwitterAccessKey": "<Access token>",
"TwitterAccessSecret": "<Access token secret>"

TwitterTrigger

// Runs when a tweet containing the word "azure" is detected
public static async Task Run([TwitterTrigger("azure")]MatchedTweetReceivedEventArgs tweetEvent, ILogger log)
{
    log.LogInformation($"\n@{tweetEvent.Tweet.CreatedBy.ScreenName}[{tweetEvent.Tweet.CreatedBy.Name}]\n" +
        $"Tweeted: {tweetEvent.Tweet.FullText}\n" +
        $"HashTags: [{String.Join(",", tweetEvent.Tweet.Hashtags.Select(x => $"#{x.Text}"))}]");
}

// Runs when a tweet containing the hashtag "#azure" is detected
public static async Task Run([TwitterTrigger("#azure")]MatchedTweetReceivedEventArgs tweetEvent, ILogger log)
{
    log.LogInformation($"\n@{tweetEvent.Tweet.CreatedBy.ScreenName}[{tweetEvent.Tweet.CreatedBy.Name}]\n" +
        $"Tweeted: {tweetEvent.Tweet.FullText}\n" +
        $"HashTags: [{String.Join(",", tweetEvent.Tweet.Hashtags.Select(x => $"#{x.Text}"))}]");
}

// Runs when a tweet by @introtocs is detected
public static async Task Run([TwitterTrigger(user: "introtocs")]MatchedTweetReceivedEventArgs tweetEvent, ILogger log)
{
    log.LogInformation($"\n@{tweetEvent.Tweet.CreatedBy.ScreenName}[{tweetEvent.Tweet.CreatedBy.Name}]\n" +
        $"Tweeted: {tweetEvent.Tweet.FullText}\n" +
        $"HashTags: [{String.Join(",", tweetEvent.Tweet.Hashtags.Select(x => $"#{x.Text}"))}]");
}

// Runs when a tweet by @introtocs is detected containing the hashtag "#azure"
public static async Task Run([TwitterTrigger("#azure", "introtocs")]MatchedTweetReceivedEventArgs tweetEvent, ILogger log)
{
    log.LogInformation($"\n@{tweetEvent.Tweet.CreatedBy.ScreenName}[{tweetEvent.Tweet.CreatedBy.Name}]\n" +
        $"Tweeted: {tweetEvent.Tweet.FullText}\n" +
        $"HashTags: [{String.Join(",", tweetEvent.Tweet.Hashtags.Select(x => $"#{x.Text}"))}]");
}

License

This project is licensed under the MIT License

Release Notes

Upgraded libraries to continue working with Twitter API

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.0 146 11/23/2020
1.0.0 560 1/13/2019