Tutorial: Automating Trade Notifications (ios/android) for AFK Players in Path of Exile 2
# Tutorial: Automating Trade Notifications (ios/android) for AFK Players in Path of Exile 2
This tutorial explains how to set up a script to send trade notifications directly to your phone using Pushover while you are AFK in Path of Exile 2. This guide includes all the necessary steps, from setting up the tools to running the script, and aims to help players stay responsive even when away from their PCs. --- ## Prerequisites Before starting, ensure you have: 1. **Python Installed**: Download Python from [python.org](https://www.python.org/downloads/) and install it. - During installation, check the option to "Add Python to PATH." 2. **Pushover Account**: Sign up for a Pushover account at [pushover.net](https://pushover.net/). - Create a new application in Pushover to obtain your **API Token**. - Copy your **User Key** from your Pushover dashboard. 3. **Access to Path of Exile 2 Logs**: - The default location is: - `C:\Program Files (x86)\Steam\steamapps\common\Path of Exile 2\logs\Client.txt` - The log file path may differ based on your Steam library configuration. Adjust the path as needed. 4. **Basic Text Editor**: Use any text editor, such as Notepad or VS Code, to edit and save the script. --- ## Step-by-Step Setup ### 1. Install Required Python Libraries Open a terminal or command prompt and run the following command to install the `requests` library: ```bash pip install requests ``` This library is required for sending notifications via Pushover. ### 2. Write the Python Script Create a new file named `poe2_trade_notifications.py` and copy the following script into it: ```python import time import requests # Configuration Pushover PUSHOVER_USER_KEY = "your_user_key_here" # Replace with your Pushover User Key PUSHOVER_API_TOKEN = "your_api_token_here" # Replace with your Pushover API Token API_URL = "https://api.pushover.net/1/messages.json" # Path to the Client.txt log file of Path of Exile 2 LOG_FILE_PATH = r"C:\\Program Files (x86)\\Steam\\steamapps\\common\\Path of Exile 2\\logs\\Client.txt" # Function to send a notification via Pushover def send_notification(message): data = { "token": PUSHOVER_API_TOKEN, "user": PUSHOVER_USER_KEY, "message": message } response = requests.post(API_URL, data=data) if response.status_code == 200: print("Notification sent:", message) else: print("Error sending notification:", response.text) # Main function to monitor the log file def monitor_log_file(file_path): try: with open(file_path, "r", encoding="utf-8") as file: # Move to the end of the file file.seek(0, 2) print("Monitoring trades...") while True: line = file.readline() if not line: time.sleep(0.1) # Wait before reading again continue print("Read line:", line.strip()) # Debug: show each line # Filter trade messages in English if "Hi, I would like to buy" in line: send_notification(line.strip()) except FileNotFoundError: print(f"Error: File '{file_path}' not found.") except Exception as e: print(f"An error occurred: {e}") # Start monitoring if __name__ == "__main__": monitor_log_file(LOG_FILE_PATH) ``` ### 3. Update the Script with Your Information 1. Replace `your_user_key_here` with your **Pushover User Key**. 2. Replace `your_api_token_here` with your **Pushover API Token**. 3. Confirm the `LOG_FILE_PATH` matches the location of your `Client.txt` file. Adjust if necessary. ### 4. Test the Script Run the script from the command line: ```bash python poe2_trade_notifications.py ``` You should see: ``` Monitoring trades... ``` ### 5. Trigger a Test Notification To verify Pushover works, initiate a trade request in-game. If the script detects the trade request, it will send a notification to your phone. --- ## Optional: Run the Script on Startup 1. **Create a Shortcut**: - Right-click on the script file and select "Create Shortcut." 2. **Add to Startup Folder**: - Press `Win + R`, type `shell:startup`, and press Enter. - Move the shortcut to the Startup folder. 3. The script will now run automatically when you log into Windows. --- ## Troubleshooting - **No notifications**: - Ensure the `LOG_FILE_PATH` is correct. - Confirm your Pushover User Key and API Token are accurate. - Check your Pushover app for errors. - **File not found**: - Verify the location of your `Client.txt` file. - Adjust the `LOG_FILE_PATH` in the script if necessary. --- Sharing Your Setup Feel free to share this tutorial with other Path of Exile players! It’s a simple way to stay responsive and keep trading even when you’re AFK. Customize the script as needed and help the community improve its trading efficiency. 😊 As sellers, we deserve the right to take bathroom breaks, enjoy a meal, or watch a movie—all while having the privilege to drop everything and rush back for some Divine Orbs! 😄 Last bumped on Mar 5, 2025, 11:17:23 AM
|
![]() |
And this is why we desperately need an Auction House.
|
![]() |
If I am AFK in game, why would I want notifications sent to my phone? Are people really just leaving the game running in the computer room while watching netflix in the living room? Just log off?
Honestly, if youre flagged afk, your trades shouldnt even populate on the tradesite. I dont whisper afkers anyways. Theyre afk, how would they see my whisper? |
![]() |
Hi there! Thanks for sharing your thoughts. I completely understand your perspective, and it's true that everyone plays the game differently and has their own way of using the trade system. 😊
That said, there are situations where staying AFK while keeping trades active can be useful for some players—for example, those planning long farming sessions who don’t want to log in and out between activities IRL. It’s not about ignoring others but simply about maximizing time spent in the game. As for not whispering AFK players, that’s totally fair and your choice. However, for others, getting a quick notification can help them come back and finalize a trade they might have missed otherwise. This script isn’t meant to force any behavior; it’s just a tool for those who find it helpful. 😊 Everyone has their own playstyle, and this guide is just offering an additional option for those who might need it. Wishing you a great time in-game, and thanks again for your feedback! |
![]() |
Its easier to do that through Telegram and BotFather.
here is a script for that import requests import time import re # Ensure this is imported from datetime import datetime #Replace this with the token you get from BotFather and with the chat id to the telegram chat. For it to give a chat id you have to write to the bot in the telgram chat first.How to get chat id is here https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id API_TOKEN = 'YOUR_BOT_TOKEN' CHAT_ID = 'YOUR_CHAT_ID' TELEGRAM_URL = f'https://api.telegram.org/bot{API_TOKEN}/sendMessage' #Replace this with your Paths to the client.txt and to your logfile CLIENT_LOG_PATH = '/path/to/client.txt' LOG_FILE_PATH = '/path/to/log.txt' def send_telegram_message(message): payload = { 'chat_id': CHAT_ID, 'text': message, } response = requests.post(TELEGRAM_URL, data=payload) # Log the message to the text file log_message_to_file(message) return response.json() def log_message_to_file(message): try: with open(LOG_FILE_PATH, 'a') as log_file: timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S') log_file.write(f'[{timestamp}] {message}\n') except Exception as e: print(f"Error while logging message: {e}") def monitor_client_log(): try: with open(CLIENT_LOG_PATH, 'r') as file: file.seek(0, 2) while True: line = file.readline() if line: process_log_line(line) else: time.sleep(1) # If no new line, wait for 1 second before checking again except Exception as e: send_telegram_message(f"Error while monitoring client.txt: {str(e)}") def process_log_line(line): pattern = r"@From\s+(\S+):\s+Hi, I would like to buy your\s+([\w\s,]+)\s+listed for\s+([\d\.]+)\s+([a-zA-Z\s]+).*(?:stash tab\s+\"([^\"]+)\")" match = re.search(pattern, line) if match: player_name = match.group(1) item_name = match.group(2) price = match.group(3) currency_type = match.group(4).strip() stash_tab = match.group(5) message = f"New trade: {player_name} is buying {item_name} for {price} {currency_type} in stash tab \"{stash_tab}\"" send_telegram_message(message) if __name__ == "__main__": monitor_client_log() The regex will format the Message to have less bloat. Last edited by Alzucard#2422 on Mar 6, 2025, 5:08:45 AM
|
![]() |