Skip to content

An autonomous script that generates and posts unique tweets using OpenAI's API and OAuth2 authentication. It stores past responses in Firebase for context and runs automatically on AWS twice daily, ensuring a continuous stream of original tweets.

Notifications You must be signed in to change notification settings

cshafizadeh/XBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XBot

Try It Yourself

Go to https://us-central1-xbot-a5127.cloudfunctions.net/tweet and wait for the response. Then, check out https://twitter.com/MotivativeWords and you will see your tweet has been posted!

How It Works:

The Motivation Bot operates as an automated system for generating and posting motivational tweets on Twitter. The process involves several steps to ensure the tweets are engaging, contextually relevant, and aligned with your desired content.

Authentication:

The first step is to authenticate with the Twitter API using your Twitter Developer account credentials. This authentication allows the Lambda function to access the Twitter account and post tweets.

Tweet Generation:

The core of the functionality is the tweet generation process. The code uses the OpenAI API to generate a motivational tweet based on a predefined prompt. The prompt serves as the starting point for the AI model to create meaningful and inspiring content. You can customize the prompt to specify the tone, theme, or style of the tweet you want to generate.

Context from Conversations:

To enhance the relevance of the generated tweets, the code retrieves context from past conversations stored in a Firestore database. The retrieved context is incorporated into the prompt used for generating tweets. This ensures that the generated tweet takes into account the ongoing conversation and maintains a coherent flow.

Tweet Posting:

Once the motivational tweet is generated, the code uses the authenticated Twitter API client to post the tweet on your Twitter account. The tweet is published according to the rules and character limits set by Twitter.

Response:

After posting the tweet, the code function provides a response that indicates the success or status of the tweet posting process. This response can be used for monitoring and logging purposes.

By combining the capabilities of the OpenAI API, the Twitter API, the Firestore database, and AWS, the Motivation Bot Function streamlines the process of generating and posting motivational content on Twitter. The integration of past conversations ensures that the generated tweets are contextually relevant and aligned with the ongoing conversation, creating a more engaging and personalized experience for your audience.

Languages/Technologies Used:

Javascript, OpenAI API, Twitter API, OAuth2 Authentication, Firebase, Node.js

About

An autonomous script that generates and posts unique tweets using OpenAI's API and OAuth2 authentication. It stores past responses in Firebase for context and runs automatically on AWS twice daily, ensuring a continuous stream of original tweets.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published