Cdklabs.CdkTweetQueue 2.0.965

dotnet add package Cdklabs.CdkTweetQueue --version 2.0.965
                    
NuGet\Install-Package Cdklabs.CdkTweetQueue -Version 2.0.965
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cdklabs.CdkTweetQueue" Version="2.0.965" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cdklabs.CdkTweetQueue" Version="2.0.965" />
                    
Directory.Packages.props
<PackageReference Include="Cdklabs.CdkTweetQueue" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cdklabs.CdkTweetQueue --version 2.0.965
                    
#r "nuget: Cdklabs.CdkTweetQueue, 2.0.965"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Cdklabs.CdkTweetQueue@2.0.965
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cdklabs.CdkTweetQueue&version=2.0.965
                    
Install as a Cake Addin
#tool nuget:?package=Cdklabs.CdkTweetQueue&version=2.0.965
                    
Install as a Cake Tool

Tweet Queue for AWS CDK

This is an AWS CDK construct library which allows you to get a feed of Twitter search results into an SQS queue. It works by periodically polling the freely available Twitter Standard Search API and sending all new tweets to an SQS queue.

Inspired by @jlhood's aws-serverless-twitter-event-source

Architecture

alternate text is missing from this package README image

  1. A CloudWatch Event Rule triggers the poller AWS Lambda function periodically
  2. The poller reads the last checkpoint from a DynamoDB table (if exists)
  3. The poller issues a Twitter search query for all new tweets
  4. The poller enqueues all tweets to an SQS queue
  5. The poller stores the ID of the last tweet into the DynamoDB checkpoint table.
  6. Rinse & repeat.

Twitter API Keys

To issue a Twitter search request, you will need to apply for a Twitter developer account, and obtain API keys through by defining a new application.

The Twitter API keys are read by the poller from an AWS Secrets Manager entry. The entry must contain the following attributes: consumer_key, consumer_secret, access_token_key and access_token_secret (exact names).

  1. Create a new AWS Secrets Manager entry for your API keys
  2. Fill in the key values as shown below: alternate text is missing from this package README image
  3. Store the key
  4. Obtain the ARN of the secret (you will need it soon).

Usage

Use npm to install the module in your CDK project. This will also add it to your package.json file.

$ npm install cdk-tweet-queue

Add a TweetQueue to your CDK stack:

using Cdklabs.CdkTweetQueue;


var queue = new TweetQueue(this, "TweetStream", new TweetQueueProps {
    // this is the ARN of the secret you stored
    SecretArn = "arn:aws:secretsmanager:us-east-1:1234567891234:secret:xxxxxxxxx",

    // twitter search query
    // see https://developer.twitter.com/en/docs/tweets/search/guides/standard-operators
    Query = "#awscdk",

    // optional properties
    IntervalMin = 60,  // optional: polling interval in minutes
    RetentionPeriodSec = 60,  // optional: queue retention period
    VisibilityTimeoutSec = 60
});

Now, queue is an sqs.Queue object and can be used anywhere a queue is accepted. For example, you could process the queue messages using an AWS Lambda function by setting up an SQS event source mapping.

Development

The project is managed by projen and offers the following commands:

  • yarn projen - Synthesize the project configuration.
  • yarn compile - Compile all source code.
  • yarn test - Run all tests.
  • yarn build - Complie, test, and package the module.

Integration test

There is also an integration test that can be executed by running the following commands. You will need to set the TWEET_QUEUE_SECRET_ARN environment variable in order for the test to be able to use your Twitter API keys.

$ yarn integ:deploy

Don't forget to destroy:

$ yarn integ:destroy

You can also run any cdk command on the integration test application by running:

yarn integ <command>

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.965 102 10/12/2026
2.0.964 189 9/28/2026
2.0.963 156 8/10/2026
2.0.962 134 8/3/2026
2.0.961 141 7/27/2026
2.0.960 139 7/20/2026
2.0.959 149 7/13/2026
2.0.958 146 7/6/2026
2.0.957 155 6/29/2026
2.0.956 148 6/22/2026
2.0.955 143 6/15/2026
2.0.954 147 6/8/2026
2.0.953 154 6/1/2026
2.0.952 146 5/25/2026
2.0.951 135 5/18/2026
2.0.950 148 5/11/2026
2.0.949 141 5/4/2026
2.0.948 152 4/27/2026
2.0.947 144 4/20/2026
2.0.946 156 4/13/2026
Loading failed