From 917ad39b1e60f81ac7100f8dcaaa89172bacac1d Mon Sep 17 00:00:00 2001 From: dataprolet Date: Mon, 28 Jul 2025 15:45:16 +0200 Subject: [PATCH] Update README.md --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3242cfb..75b1b8b 100644 --- a/README.md +++ b/README.md @@ -6,12 +6,46 @@ This script sends the last message from a specifiec Bluesky conversation with a The script expects the following variables: -WORKING_DIR="$(pwd)" # Can be change to whatever directory. -PDSHOST="" # If your not hosting your PDS it's probably "https://bsky.social". -BLUESKY_HANDLE="" # The handle of your Blueksy bot account, e. g. my-bluesky-bot.bsky.social. -BLUESKY_PASSWORD="" # Either your Bluesky bot account's password or it's app password (https://bsky.app/settings/app-passwords). -CONVO_ID="" # Conversation-ID of the BLuesky bot account, can be retriefed by using get_messages. -CHAT_ID="" # Chat-ID of the Telegram bot, see here: https://linuxscriptshub.com/send-telegram-message-linux-scripts. -TOKEN="" # Token for the Telegram bot, can be retreived from t.me/BotFather. +| Variables | Description | +| --- | --- | +| **WORKING_DIR** | Can be changed to whatever directory | +| **PDSHOST** | If your not hosting your own PDS it's probably *https://bsky.social* | +| **BLUESKY_HANDLE** | The handle of your Blueksy bot account, e. g. *my-bluesky-bot.bsky.social* | +| **BLUESKY_PASSWORD** | Either your Bluesky bot account's password or it's app password (https://bsky.app/settings/app-passwords) | +| **CONVO_ID** | Conversation-ID of the Bluesky bot account, can be retriefed by using get_messages | +| **CHAT_ID** | Chat-ID of the Telegram bot | +| **TOKEN** | Token for the Telegram bot | -## Usage \ No newline at end of file +## Setup + +### 1. Create Bluesky bot account +- Create a new Bluesky account +- It's recommended to [create an app password](https://bsky.app/settings/app-passwords) for your Bluesky account and allow access to DMs +- Paste your PDS host's URL (**PDSHOST**), your account's handle (**BLUESKY_HANDLE**) and (app) password (**BLUESKY_PASSWORD**) into the script's respective variables +- Follow your main Bluesky account, so that it can send the bot account DMs + +### 2. Create a Telegram bot +- Create a new bot using the [@BotFather](t.me/botfather) +- Paste the bot's token in the script as the **TOKEN** variable +- Send any message to the bot +- Visit https://api.telegram.org/bot<$TOKEN>/getUpdates and retrieve the **CHAT_ID** + - The URL should look something like this: `https://api.telegram.org/bot123456789:ABCdefGHI123_abcDEF/getUpdates` + - The **CHAT_ID** can be found in the following key `.results.0.message.chat.id` + +### 3. Retrieve your CONVO_ID +- Login to your main Bluesky account and send any message to your Bluesky bot account +- Start the script using the argument 'create_session' so retrieve the Bluesky token (*token.json*) +- Start the script again using the argument `get_message` to get the **CONVO_ID** +- Paste the output in the script as the **CONVO_ID** + +## Usage +- Start the script without any argument +- The script should create the `bluesky.json` and `last_id.txt` files and send a message to your Telegram bot +- Now you can deploy the script e. g. using `rontab to run continously + +## Files + +The script createts and uses several files to store persistent variables. +- `bluesk.json` stores the latest Bluesky message ID, URI and poster's account handle +- `last_id.txt`stores the Bluesky message ID of the last message that was succesfully sent to Telegram +- `token.json` stores the Bluesky **ACCESS_JWT** and **REFRESH_JWT** token \ No newline at end of file