Automatically respond to Instagram direct messages based on predefined rules.
Project description
Instagram Direct Message Autoresponder
This project allows you to automatically respond to direct messages (DMs) on Instagram based on predefined rules. It uses the instagrapi
library to interact with Instagram's API.
Features
- Automatic response to incoming direct messages based on predefined rules.
- Configuration settings for auto-reply, check interval, keep-alive duration, and log file path.
- Logs for all messages and responses.
- Test cases using Pytest.
Installation
- Clone this repository to your local machine.
- Install the required dependencies using pip: pip install -r requirements.txt
Usage
- Create a configuration JSON file with your Instagram credentials, rules, and settings. Here's an example configuration:
{
"username": "your_instagram_username",
"password": "your_instagram_password",
"rules": {
"hi|hello|hey": "Hi there! How are you doing?",
"how are you|how r u": "I'm doing well, thanks for asking! How about you?",
"default": "Sorry, I didn't understand that."
},
"settings": {
"auto_reply": true,
"check_interval_seconds": 60,
"keep_alive_minutes": 5,
"log_file": "instagram_bot_logs.txt"
}
}
Run the script with the path to your configuration file:
python main.py --config path/to/your/config.json
Configuration
username
: Your Instagram username.password
: Your Instagram password.rules
: Dictionary containing message patterns and corresponding responses.settings
:auto_reply
: Whether to automatically reply to messages. Default is true.check_interval_seconds
: Interval (in seconds) to check for new messages. Default is 60.keep_alive_minutes
: Duration (in minutes) to keep the application running. Set to null to run indefinitely.log_file
: Path to the log file. Default is instagram_bot_logs.txt.
Testing
To run the test cases, use the following command:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for instagram_autoresponder-0.0.2a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d49f1e1ae864ce77f2845712ae2617457d4f65310fa050e3826c083775ab3d5 |
|
MD5 | e221e0bebfffea7eaa5fb431872a2c15 |
|
BLAKE2b-256 | e3b96699183e73e84f8aa4fdd754600fbe896491adb3f5aea62b033c7b55f548 |
Close
Hashes for instagram_autoresponder-0.0.2a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30b8447fcebd4da0320e32e4d9643a1a0cf78fdfb6ca3275ef4856802aa796b6 |
|
MD5 | bca31baac6c7106c84ae716994b35706 |
|
BLAKE2b-256 | 668dc65bfaaaaab48ffa36d66a425343f39cf1974eae7767d6614f69ef39e2d1 |