{"id":22672327,"url":"https://github.com/jimlynchcodes/plug-n-play-twitter-engager","last_synced_at":"2025-10-07T04:16:19.290Z","repository":{"id":43948584,"uuid":"261840206","full_name":"JimLynchCodes/Plug-N-Play-Twitter-Engager","owner":"JimLynchCodes","description":"Easy-to-use command-line tool that searches for a tweet matching some keywords, likes it, retweets it, and follows its creator!","archived":false,"fork":false,"pushed_at":"2022-12-11T04:54:30.000Z","size":3318,"stargazers_count":2,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T11:55:31.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JimLynchCodes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-06T18:03:00.000Z","updated_at":"2021-11-06T23:16:15.000Z","dependencies_parsed_at":"2023-01-26T15:45:47.402Z","dependency_job_id":null,"html_url":"https://github.com/JimLynchCodes/Plug-N-Play-Twitter-Engager","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FPlug-N-Play-Twitter-Engager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FPlug-N-Play-Twitter-Engager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FPlug-N-Play-Twitter-Engager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JimLynchCodes%2FPlug-N-Play-Twitter-Engager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JimLynchCodes","download_url":"https://codeload.github.com/JimLynchCodes/Plug-N-Play-Twitter-Engager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246176341,"owners_count":20735753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-09T16:18:53.385Z","updated_at":"2025-10-07T04:16:19.223Z","avatar_url":"https://github.com/JimLynchCodes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plug N' Play Twitter Engager\n\n\n\u003cimg src=\"./art/plug-n-play-twitter-engager-logo.png\" alt=\"plug-n-play-twitter-engager-logo\" align=\"right\" width=\"175\"/\u003e\n\n\u003cdiv \u003e\n\u003cp margin=\"30px\"\u003e\nEasy-to-use command-line tool that searches for a tweet matching some keywords, likes it, retweets it, and follows its creator!\n\u003c/p\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n## How It Works\n\nThe script should do this:\n\n  Pull 100 latest original tweets matching the keywords (excluding retweets),\n\n  then randomly select one that hasn't already been liked,\n\n  and on behalf on the account whose creds were provided:\n  - likes the tweet.\n  - retweets the tweet (with no comment).\n  - follows the user who created the tweet.\n\n\u003cbr/\u003e\n\n## Usage Guide\n\n#### - Step 1 - Plug in Your Credentials.\n\n#### - Step 2 - Run the Twitter Engager \n\n#### - Step 3 (Optional) - Schedule as a Cron Job.\n\n\u003cbr/\u003e\n\n## Step 1 - Plug in Your Credentials.\n\n- ### Get Credentials From Twitter\n  First, you'll need to create an app here: https://developer.twitter.com/\n\n  In order to get credentials, you will need to get an app \"approved\".\n\n  The most difficult part of this all is waiting for Twitter to get back to you... 🙄\n\n  Once your app has been approved, you can find the credentials by going to Apps -\u003e Details -\u003e Keys \u0026 Tokens.\n\n- ### Create a Config.js file\n\n  Copy the config_SAMPLE.js file and rename it just `config.js`. \n\n  ```\n  cp config_SAMPLE.js config.js\n  ```\n\n  config.js\n  ```\n  module.exports = {\n    keywords: 'Giveaway! like to enter',\n    creds: {\n        consumer_key: '...',\n        consumer_secret: '...',\n        access_token: '...',\n        access_token_secret: '...'\n    },\n    minWaitTime: 400,\n    maxWaitTime: 1200,\n    minSentiment: 1\n  }\n  ```\n\n  Enter your credentials from twitter as the values for the corresponding fields in `creds` within the config.js file.\n\n  You should also set the `keywords` config property to a string as this is the default keywords used to search for a tweet when none is passed in via the `--keywords` flag.\n\n\u003cbr/\u003e\n\n## Step 2 - Run the Script\n\n  - ### Set your node verison\n    It is recommended to use a recent node version such as v13.13.0 (or whatever is set in the .nvmrc file)\n    ```\n    nvm use\n    ```\n\n  - ### Install Depencies\n    Run the usual npm isntall command.\n    ```\n    npm i\n    ```\n\n  - ### Run the start script\n    This project uses the familiar old `start` script to run the whole twitter engagement process.\n    ```\n    npm start\n    ```\n\n    Note: be sure to use the `--` before the flags as to pass them to the underlying command for `npm start`\n\n    ```\n    npm start -- --keywords=\"new york knicks\"\n    ```\n    \n\u003cbr/\u003e\n\n## Step 3 - Schedule As A Cron Job\n\n  - ### Using a Remote Server\n    This [blog post]() is a nice guide on setting up a new Ubuntu server from Digital Ocean for running cron jobs.\n    \n    These can also be scheduled on your local machine, but they won't run if it is turned off or asleep.\n    \n     \u003cbr/\u003e\n     \n  - ### Edit The Crontab\n    \n    To open the crontab editor:\n    ```\n    crontab -e\n    ```\n    \n    On a new line, put the schedule on which you'd like the script to run (see [gronguru](https://crontab.guru/) for help) followed by the command to run. \n    \n    The below example schedules the script to ONLY like a tweet found with the default search keywords every day at 4:05pm. \n    ```\n    # My applesauce tweeting cronjob  \n      */12 * * * * cd ~/Git-Projects/Plug-N-Play-Twitter-Engager \u0026\u0026 ./run-twitter-engager.sh --keywords=\\\"applesauce\\\"\n    ```\n    \n    ## Bash Script\n    Sometimes when running in a cron environment you need to \"setup\" again (navigate to the proejct directory, load nvm and node into the PATH, etc.)\n\n    _Note: Although the node process uses Winston to write logs to the project's `logs` folder, you can pipe the output of the crontab execution which can be helpful for debugging inproperly running jobs:_\n    ```\n\n    # My applesauce tweeting cronjob  \n      */12 * * * * cd ~/Git-Projects/Plug-N-Play-Twitter-Engager \u0026\u0026 ./run-twitter-engager.sh --keywords=\\\"applesauce\\ \u003e\u003e ~/Git-Projects/Plug-N-Play-Twitter-Engager/logs/cron-logs_`date +\\%Y-\\%m-\\%d`.log 2\u003e\u00261\"\n \n    _Note the use of backlashes to escape the quotes when passing arguments to the bash file._\n\n\nThere is a bash file included in this project, and you can conveniently pass all the arguments you would pass to `npm start` along when you execute the shell script and it will call `npm start` with these additional arguments.\n\nFor example:\n```\n./run-twitter-engager.sh --keywords=\\\"I like pizza\\\"\n```\nYou may find that the cron execution environment does not have access to necessary things such as `nvm`. In this case it is recommended to schedule the cron job to execute a bash file which calls `npm start` after the proper setup instead of running the `npm start` command directly. Create a bash file like the one included here and allow your shell's current user to execute it.\n```\nchmod +x run-twitter-engager.sh\n```\n\n\u003cbr/\u003e\n\n## Flags\nYou can use `--` to pass arguments into script, and these flags allow you to disable certain interactions and/or override the search keywords.\n\n| Flag          | Flag Arguments| Purpose  |\n| ------------- |:-------------:| :-----|\n| `--keywords`  | String        | Overrides the keywords provided in `config.js` |\n| `--no-like`   | None          | Skips over liking the tweet when the script is run. |\n| `--no-retweet`| None          | Skips over liking the tweet when the script is run. |\n| `--no-follow` | None          | Skips over liking the tweet when the script is run. |\n| `--min-wait-time` | Integer          | Minimum number of milliseconds to wait between engagement actions. |\n| `--max-wait-time` | Integer          | Maximum number of milliseconds to wait between engagement actions. |\n| `--quiet` | None          | Much shorter logs. |\n\n\nExample:\n```\nnpm start -- --keywords=\"love Javascript\" --no-like --no-follow --no-retweet --min-wait-time=200 --max-wait-time=800 --quiet\n```\n\n\u003cbr/\u003e\n\n\n## Wait Times\nIn order to simulate actual user interactions on Twitter, the requests for like, retweet, and follow are not executed simultaneously. Instead, the _like_ is executed immediately, and then a random amount of time betwen the `minWaitTime` and `maxWaitTime` goes by. After this, the _retweet_ is executed, a new random amount of time within bounds in chosen, and after waiting this much time the _follow_ is executed.\n\nThe defaults for `minWaitTime` and `maxWaitTime` are 400 and 1100 milliseconds, respectively, and you can change these values by setting them differently in the `config.js` file or via the command line flags.\n\n\u003cbr/\u003e\n\n\n## Sentiment!\n\n\u003cbr/\u003e\n\n\n## Logs\nAll logging is performed using [Winston](https://github.com/winstonjs/winston)'s _info_ and _error_ levels. By default info logs are written to the `./logs` directory into a file prefixed with \"logs-\", followed by the current calendar date. Similarly, the errors are written in ./logs to a file prefixed \"errors-\" then followed by the current calendar date.\n\nThere is extensive logging in the script for debuggin purposes, but they can be silenced with the `--quiet` flag.\n\n\u003cbr/\u003e\n\n\n## Based On Twit\nShoutout to the nice library [twit](https://github.com/ttezel/twit) This project leverages the for executing the Twitter interactions.\n\n\u003cbr/\u003e\n\n## Contributing\nWe'd love to hear all about your ideas, suggestions, and how you're using this project!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimlynchcodes%2Fplug-n-play-twitter-engager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimlynchcodes%2Fplug-n-play-twitter-engager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimlynchcodes%2Fplug-n-play-twitter-engager/lists"}