A Node.js script that checks the SAP Community Network (SCN) RSS feeds every 60 minutes and posts new blog entries to your Bluesky account. The bot includes metadata like the blog source (by SAP or by Members), author, and maintains a local list of posted entries to avoid duplicates. It respects Bluesky's rate limits and supports automated deployment via GitHub Actions.
https://community.sap.com/khhcw49343/rss/board?board.id=technology-blog-sap
https://community.sap.com/khhcw49343/rss/board?board.id=technology-blog-members
fetch
API support).Clone the Repository
git clone https://github.com/marianfoo/bluesky-rss-bot.git
cd bluesky-rss-bot
Install Dependencies
npm install
Create a .env
File
In the project root directory, create a file named .env
:
touch .env
Add Your Bluesky Credentials
Open the .env
file and add your Bluesky username and password:
BLUESKY_USERNAME=your_bluesky_username
BLUESKY_PASSWORD=your_bluesky_password
Note: Replace your_bluesky_username
and your_bluesky_password
with your actual Bluesky credentials.
Secure the .env
File
Ensure the .env
file is not tracked by Git by adding it to .gitignore
:
echo '.env' >> .gitignore
Configure GitHub Secrets (For Automated Deployment)
If using the automated GitHub Actions deployment, set up the following secrets in your GitHub repository settings:
SSH_IP
: Your server's IP address.SSH_USER
: SSH username (e.g., root
or another user with deployment permissions).SSH_PRIVATE_KEY
: Your SSH private key (ensure it is properly formatted).Start the Script
node index.js
Verify Output
The script should log messages indicating it has logged into Bluesky and is checking the RSS feeds.
For production environments, it's recommended to use a process manager like PM2 to keep the script running continuously.
npm install -g pm2
pm2 start index.js --name bluesky-scn-bot
pm2 startup
Follow the instructions output by the command to enable PM2 to run on system startup.
pm2 save
The project includes a GitHub Actions workflow (deploy.yaml
) for automated deployment to your server when changes are pushed to the main
branch.
Configure SSH Access
SSH_PRIVATE_KEY
.SSH_IP
and SSH_USER
, respectively.GitHub Actions Workflow
The deploy.yaml
workflow performs the following steps:
main
branch.Trigger Deployment
main
branch:git add .
git commit -m "Your commit message"
git push origin main
Deployment Process
If you prefer to update the script manually, follow these steps:
ssh your_username@your_server_ip
cd /path/to/bluesky-scn-bot
pm2 stop bluesky-scn-bot
git pull origin main
If any dependencies have changed, install them:
npm install
pm2 start index.js --name bluesky-scn-bot
pm2 save
View Logs
pm2 logs bluesky-scn-bot
Stream Logs
pm2 logs
Log Rotation
Install the PM2 log rotate module:
pm2 install pm2-logrotate
Configure log rotation settings:
pm2 set pm2-logrotate:max_size 10M
pm2 set pm2-logrotate:retain 7
This project is licensed under the MIT License. See the LICENSE file for details.
Data Persistence
posted_ids.json
to keep track of posted blog entries.Security Considerations
.env
file secure and never commit it to version control.Error Handling
Contributions
The Bluesky SCN Bot script automates the process of fetching new blog posts from the SAP Community Network and posting them to your Bluesky account. It handles multiple RSS feeds, includes metadata like the blog source and author, and ensures posts comply with Bluesky's character limit. The script supports automated deployment using GitHub Actions, making it easy to keep your production environment up-to-date.
By following the steps outlined above, you can set up, run, and maintain the bot in both development and production environments.
If you have any questions or need further assistance, feel free to contact the repository maintainer.