A bot for posting RSS feed updates to Bluesky using Node.js (and Docker).
- Fetches RSS feeds and posts new updates to a Bluesky account.
- Avoids duplicate posts by tracking links locally.
- Fetches metadata (title, description, thumbnail) for embedded links.
- Adheres to Bluesky's API rate limits.
- Configurable post frequency, duplicate-checking, and freshness criteria.
Choose your preferred setup method:
- Standard Node.js Installation: If you are comfortable with Node.js.
- Docker Installation: Recommended if you prefer to use containers.
Follow these steps to set up and run the bot using Node.js:
git clone https://github.com/cgillinger/Blueskybot.git
cd Blueskybot
Install all required dependencies:
npm install
- Open the included
.env
file and replace placeholder values with your Bluesky credentials:
BLUESKY_USERNAME=[email protected]
BLUESKY_PASSWORD=your_secure_password
- Important: The
.env
file must remain in the project directory for the bot to work.
- Open
bot.mjs
in a text editor. - Update the
RSS_FEEDS
array with the RSS feed URLs you want the bot to monitor:
const RSS_FEEDS = [
{ url: 'https://example.com/rss-feed-1.xml', title: 'Example Feed 1' },
{ url: 'https://example.com/rss-feed-2.xml', title: 'Example Feed 2' },
];
Run the bot:
npm start
Docker simplifies setup and eliminates dependency conflicts. Here’s how to use Docker:
Docker allows you to package an application and its dependencies into a container, ensuring it runs consistently across environments.
Navigate to the project directory using the terminal. This is the folder where your Dockerfile
is located, typically the root directory of the repository you cloned. Then, run the following command:
docker build -t bluebot .
docker build
: Tells Docker to build an image.-t bluebot
: Names the image "bluebot.".
: Refers to the current directory.
Ensure your .env
file is ready with valid Bluesky credentials.
Start the container:
docker run --env-file .env -d --name bluebot-container bluebot
--env-file .env
: Passes environment variables to the container.-d
: Runs the container in detached mode.--name bluebot-container
: Names the container.
Check the logs to ensure the bot is running:
docker logs bluebot-container
To stop the container:
docker stop bluebot-container
To remove the container:
docker rm bluebot-container
The provided Dockerfile sets up the container for running the bot. Here’s a breakdown:
-
Base Image:
FROM node:18
- Uses the official Node.js 18 image as the base environment.
-
Set Working Directory:
WORKDIR /app
- Defines
/app
as the working directory where all subsequent commands will run.
- Defines
-
Install Dependencies:
COPY package*.json ./ RUN npm install --only=production
- Copies
package.json
andpackage-lock.json
into the container and installs required dependencies.
- Copies
-
Add Project Files:
COPY . .
- Copies all files from your local project directory into the container.
-
Start the Bot:
CMD ["node", "bot.mjs"]
- Starts the bot script when the container runs.
If you see Invalid identifier or password
:
- Double-check your
.env
file for correct credentials. - Verify your Bluesky account is active.
If rate limits are encountered (status code 429
), the bot automatically retries after the required wait time.
If you encounter missing modules, reinstall them:
npm install
Contributions are welcome! Open an issue or submit a pull request to improve this project.
This project is licensed under the ISC License.