How I Built a Twitter Keyword Monitoring Using a Serverless Node.js Function With AWS Amplify

This page summarizes the projects mentioned and recommended in the original post on dev.to

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • twitter-api-client

    Discontinued A user-friendly Node.js / JavaScript client library for interacting with the Twitter API.

  • const mokkappsTwitterId = 481186762; const searchQuery = 'mokkapps'; const searchResultCount = 100; const fetchRecentTweets = async secretValues => { // Configure Twitter API Client const twitterClient = new twitterApiClient.TwitterClient({ apiKey: secretValues.TWITTER_API_KEY, apiSecret: secretValues.TWITTER_API_KEY_SECRET, accessToken: secretValues.TWITTER_ACCESS_TOKEN, accessTokenSecret: secretValues.TWITTER_ACCESS_TOKEN_SECRET, }); // Trigger search endpoint: https://github.com/FeedHive/twitter-api-client/blob/main/REFERENCES.md#twitterclienttweetssearchparameters const searchResponse = await twitterClient.tweets.search({ q: searchQuery, count: searchResultCount, result_type: 'recent', }); // Access statuses from response const statuses = searchResponse.statuses; };

  • murder

    Large scale server deploys using BitTorrent and the BitTornado library (by ervinb)

  • const twitterApiClient = require('twitter-api-client'); const { formatDistance } = require('date-fns'); const mokkappsTwitterId = 481186762; const searchQuery = 'mokkapps'; const searchResultCount = 100; const mapStatus = status => { const { id_str: id, created_at, in_reply_to_screen_name, in_reply_to_status_id_str, text, retweet_count, favorite_count, user: { screen_name: user_screen_name, followers_count, created_at: userCreatedAt, friends_count, }, } = status; const createdAtLocaleString = new Date(created_at).toLocaleString(); const url = `https://twitter.com/${user_screen_name}/status/${id}`; const userUrl = `https://twitter.com/${user_screen_name}`; const originalUrl = in_reply_to_screen_name ? `https://twitter.com/${in_reply_to_screen_name}/status/${in_reply_to_status_id_str}` : null; const userCreatedDateDistance = formatDistance( new Date(), new Date(userCreatedAt) ); return ` From ${userUrl}>${user_screen_name} at ${createdAtLocaleString} Followers: ${followers_count}, Following: ${friends_count}, Account Created: ${userCreatedDateDistance} ago ${text} ${url} style="margin-top: 10px">Tweet (Likes: ${favorite_count}, Retweets: ${retweet_count}) ${ originalUrl ? ` ${originalUrl}>Original Tweet` : '' } `; }; const isTweetedInLast24Hours = status => { const tweetDate = new Date(status.created_at); const now = new Date(); const timeDifference = now.getTime() - tweetDate.getTime(); const daysDifference = timeDifference / (1000 * 60 * 60 * 24); return daysDifference <= 1; }; const fetchRecentTweets = async secretValues => { const twitterClient = new twitterApiClient.TwitterClient({ apiKey: secretValues.TWITTER_API_KEY, apiSecret: secretValues.TWITTER_API_KEY_SECRET, accessToken: secretValues.TWITTER_ACCESS_TOKEN, accessTokenSecret: secretValues.TWITTER_ACCESS_TOKEN_SECRET, }); const searchResponse = await twitterClient.tweets.search({ q: searchQuery, count: searchResultCount, result_type: 'recent', }); const statuses = searchResponse.statuses; const tweets = statuses .filter(status => { const isNotOwnAccount = status.user.id !== mokkappsTwitterId; const isNoReply = status.in_reply_to_status_id === null; const isNoRetweet = status.retweeted_status === null; return ( isNotOwnAccount && isNoReply && isNoRetweet && isTweetedInLast24Hours(status) ); }) .map(status => mapStatus(status)); const retweets = statuses .filter(status => { const isNotOwnAccount = status.user.id !== mokkappsTwitterId; const isRetweet = status.retweeted_status; return isNotOwnAccount && isRetweet && isTweetedInLast24Hours(status); }) .map(status => mapStatus(status)); const replies = statuses .filter(status => { const isNotOwnAccount = status.user.id !== mokkappsTwitterId; const isReply = status.in_reply_to_status_id !== null; return isNotOwnAccount && isReply && isTweetedInLast24Hours(status); }) .map(status => mapStatus(status)); return { tweets, retweets, replies, }; }; module.exports = fetchRecentTweets;

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • aws-lambda-java-libs

    Official mirror for interface definitions and helper classes for Java code running on the AWS Lambda platform.

  • If we successfully pushed the function to AWS, we can manually invoke the function in AWS Lamba by clicking the “Test” button:

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Frontend Javascript code for interacting with the Twitter API

    2 projects | /r/learnjavascript | 12 Jun 2022
  • Convert twitter threads into dev.to blogs in a single click 🔥

    2 projects | dev.to | 18 Jun 2021
  • Building "yet another" product in a very established market?

    1 project | /r/Entrepreneur | 22 Mar 2021
  • Simple Twitter Bot With Node.js Tutorial Part 3: Search and Retweet

    2 projects | dev.to | 20 Mar 2021
  • Build a Twitter bot with arc.codes ⚡️

    2 projects | dev.to | 9 Mar 2021