This is an example of a Bluesky bot that responds to mentions and replies by passing the post text to a flow built with Langflow and responding with the result of the flow.
The bot uses the AT Protocol to communicate with Bluesky and is powered by @skyware/bot.
It listens for mentions and replies to an account you provide. When it receives an incoming post it will trigger a Langflow flow with the text from the post, and reply using the output from the flow.
To run this application you will need:
- Node.js (version 22)
- A Bluesky account
- Generate an app password for the account, you will need it later
- A DataStax account (sign up for a free account here)
- You can use the self-hosted version of Langflow but you will need to adjust the code to remove or update how the API key is handled
- For generative AI flows: accounts API keys for any service you want to use
Clone the repo:
git clone https://github.com/philnash/langflow-bluesky-bot.git
cd langflow-bluesky-botInstall the dependencies:
npm installCopy the .env.example file to .env:
cp .env.example .envFill in the .env file with your Bluesky account name and app password.
Log into your DataStax account and open the Langflow dashboard. Create a flow that has a chat input, does some processing in the middle, and returns the result as a chat output.
If you're getting started with Langflow, the Basic Prompting template is the simplest generative AI flow that will work. Make sure you fill in the model component with an API key.
Once you are happy with the flow, click on the API button. This will show you how to access the flow via API. You will need the URL, which is most easily found on the cURL tab. You will also need an API token, which you can generate from the modal.
Once you have the URL and token, fill in the rest of the variables in the .env file.
Once you have all your credentials you can run the application with the following command:
npm run devThis runs the app in a development mode where it will recompile and restart when you make a change.
If you want to run the application without that, you can build it first, which will compile the TypeScript into plain JavaScript.
npm run buildThen you can run the JavaScript directly with:
npm start