Send your latest Instagram posts to your Telegram channel with instagrapi and a Telegram bot.
- Shares pictures, albums and videos
- Optional login to pull private posts
- Only shares posts that have not been shared
- Use of SFTP for creating checkpoint files
- Uses secrets as environment variables
- Runs with GitHub Actions
- Defining GitHub Secrets as environment variables
- Python 3.11+ (for local run)
- Telegram bot (follow the guide)
- Instagram account (optional login, but required when pulling public data fails)
Customize the configuration by setting up the required parameters, either in GitHub Secrets or the .env
file:
Parameter | Description |
---|---|
INSTAGRAM_USERNAME |
Your Instagram username |
INSTAGRAM_PASSWORD |
Your Instagram password (optional) |
TELEGRAM_BOT_TOKEN |
Your Telegram bot token (use BotFather to create your bot by following this guide) |
TELEGRAM_CHANNEL_ID |
Your Telegram channel ID (if public, @channel_name ; if private, forward a message from the channel to GetIDs Bot and use the ID from "Origin chat" that starts with -100 ) |
SFTP_SERVER |
Your SFTP server |
SFTP_USERNAME |
Your SFTP username |
SFTP_PASSWORD |
Your SFTP password |
SFTP_PATH |
Your SFTP path |
Please note that PRIVATE_ACCESS
is set by default to "N"
in the .env
file.
- Fork the repo
- Open your repo settings
- Go to "Security > Secrets and variables > Actions"
- Create and define your parameters with the button "New repository secret"
- Push any change to the
main
branch to trigger the job
Due to limitations with GitHub Actions, jobs are executed every 6 hours, and in-progress jobs are canceled if a new job is executed before that.
- Clone the repository and navigate to the project directory:
git clone https://github.com/chdelacr/instagram-to-telegram.git cd instagram-to-telegram
- Update the
.env
file with your parameters between double quotes (""
) - Create and activate a virtual environment:
python -m venv venv # Linux and macOS: source venv/bin/activate # Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Run the job:
python main.py
This is a personal project and is not affiliated with Instagram or Telegram in any way.