Check status · Report Bug · Request Feature
- Fork and clone the repo (Optional: Leave a ⭐)
- Create a .env file at the root and paste the following
SECRET=<a_secure_secret_message>
OPENAI_API_KEY=<openai_api_key>
OPENAI_ORGANIZATION_ID=<openai_organization_id>
OPENAI_PROJECT_ID=<openai_project_id>
X_API_KEY=<twitter_api_key>
X_API_KEY_SECRET=<twitter_api_key_secret>
X_ACCESS_TOKEN=<twitter_access_token>
X_ACCESS_TOKEN_SECRET=<twitter_access_token_secret>
- Replace the key values with your key. Read about getting OpenAi key and Twitter key
- Create a virtual env (Optional)
python -m venv venv
source .venv/bin/activate
- Install the requirements
pip install -r requirements.txt
- Run your app
python main.py
- Test you app
curl -H 'Content-Type: application/json'
-d '{"secret" : "<the_secret_you_used_above>"}' \
-X POST \
<your_endpoint>/api/tweet
- If you get a success message, congratulations! 🎉
- If you face any errors connect with me.
You can personalize your bot by exploring src/clients/OpenAI.py and src/service/generate_topic.py
- Sign in/Sign up at render.com (Recomended: use github to sign in/sign up)
- Create New web service and connect this repo
- In the Start command enter the following
gunicorn main:bot
- Add all the environemt variables
- Most likey your app will be deployed without errors
- Go to your repository settings
- In the left sidebar, click on Secrets and variables > Actions
- Click the New repository secret button.
- In the Name enter - URL
- In the Secrte enter your POST endpoint which will look something like below
https://<your_unique_app_name>.onrender.com/api/tweet
- Again click the New repository secret button.
- In the Name enter - SECRET
- In the Secret enter - <the_secret_you_used_above>
- Go to the cron-job.yml file inside .github/workflows
- Under schedule update cron according to your needs. (GitHub cron jobs run at UTC time)
- Push your code.
(FYI: You can also set this job through iPhone shortcut automation and many other ways)
You can check your logs on render if you face issues.