GoatBot-IG-Port is the official Instagram port of the popular GoatBot V2 Messenger bot. This project maintains 100% compatibility with the original GoatBot command structure while running exclusively on Instagram.
- Platform: Messenger β Instagram Direct Messages
- API:
fca-unofficialβ IG-FCA (Instagram Chat API) - Structure: Identical folder structure and command syntax
- Commands: All GoatBot V2 commands work without modification
IG-FCA is a custom-built Instagram messaging API that mimics the fca-unofficial interface, providing:
- Session-based authentication
- Message event handling
- Command processing
- Thread and user management
- Admin permissions system
- β All GoatBot V2 Commands - Every command ported to Instagram
- β Session Login - Secure authentication with session reuse
- β Event Handlers - Welcome, leave, rankup, and custom events
- β Prefix System - Customizable command prefixes
- β Admin System - Multi-level permission control
- β User Database - SQLite/JSON data persistence
- β Auto-Restart - Automatic recovery from crashes
- β Command Aliases - Multiple command names support
- π± Works in Instagram DMs (1-on-1 chats)
- π₯ Works in Instagram group chats
- π Auto-session refresh
- π‘οΈ Checkpoint recovery system
- β‘ Fast message processing
- β No dashboard (Instagram version)
- β Limited to Instagram Graph API capabilities
β οΈ Group features depend on Instagram permissions
- Node.js v16.0.0 or higher
- Instagram Account (personal or business)
- Git (for cloning)
git clone https://github.com/Gtajisan/GoatBot-IG-Port.git
cd GoatBot-IG-Portnpm installadd cookie arrya using Cookie editor add into account.txt
npm start
BOT_PREFIX=!
BOT_ADMIN_IDS=instagram_user_id_1,instagram_user_id_2
Edit `config.json`:
```json
{
"prefix": "!",
"adminBot": ["your_instagram_user_id"],
"language": "en",
"database": {
"type": "sqlite"
}
}
npm startββββββββββββββββββββββββββββββββββββββββββββββββ
β GoatBot V2 - Multi-Platform β
ββββββββββββββββββββββββββββββββββββββββββββββββ
π£ Platform: Instagram (using ig-chat-api)
Starting InstagramGoat.js...
[LOGIN] Connected to Instagram API
[BOT] Bot ID: 17841400000000000
[BOT] Prefix: !
[BOT] Commands loaded: 45
[BOT] Events loaded: 7
[LISTEN] Bot is now listening for Instagram messages
Send a direct message to your Instagram bot account:
!help - Display all commands
!balance - Check your balance
!daily - Claim daily reward
!rank - View your rank card
!admin - Admin-only commands
- Default prefix:
! - Change in
config.jsonβprefix - Per-thread prefix:
!prefix <new_prefix>
Set admin IDs in config.json:
{
"adminBot": [
"instagram_user_id_here"
]
}Admin users can:
- Use restricted commands
- Manage bot settings
- Ban/unban users
- Access bot statistics
-
Create Facebook App
- Go to developers.facebook.com
- Create new app β Business type
- Add Instagram product
-
Get Access Token
- Go to Tools β Graph API Explorer
- Select your app
- Add permissions:
instagram_basic,instagram_manage_messages - Generate token
-
Get Page ID
- Query:
me?fields=instagram_business_account - Copy the
instagram_business_account.id
- Query:
-
Configure Webhook
- Set callback URL:
https://your-replit-url.repl.co/webhook - Verify token: Same as
INSTAGRAM_VERIFY_TOKENin.env - Subscribe to:
messages,messaging_postbacks
- Set callback URL:
-
Add to .account.txt
your_token
If you have an existing session.json:
- Place
session.jsonin the root directory - Bot will automatically load it on startup
If Instagram asks for verification:
- Complete the challenge on Instagram app
- Clear
session.json - Restart bot with credentials
- New session will be generated
-
Import to Replit
- Go to replit.com/new
- Click "Import from GitHub"
- Paste:
https://github.com/Gtajisan/GoatBot-IG-Port
-
Configure Secrets
- Click "Secrets" (π) in sidebar
- Add all environment variables from
.env.example
-
Configure Run Command
- The bot auto-detects and uses
npm start - Or manually set in
.replitfile:run = "npm start"
- The bot auto-detects and uses
-
Deploy
- Click "Run" button
- For 24/7 hosting, click "Deploy" β Choose deployment tier
- Set run command:
npm start - Enable auto-scaling if needed
-
Set Webhook URL
- Copy your Replit URL:
https://your-repl-name.your-username.repl.co - Add
/webhookto the end - Update webhook in Facebook Developer Console
- Copy your Replit URL:
# Clone repository
git clone https://github.com/Gtajisan/GoatBot-IG-Port.git
cd GoatBot-IG-Port
# Install dependencies
npm install
# Create .env file
nano .env
# Add your credentials and save (Ctrl+X, Y, Enter)
# Start bot
npm start
# Optional: Use PM2 for process management
npm install -g pm2
pm2 start index.js --name goatbot-ig
pm2 save
pm2 startupKeep bot running 24/7:
# Install PM2
npm install -g pm2
# Start bot with PM2
pm2 start index.js --name goatbot-ig
# Auto-restart on reboot
pm2 startup
pm2 save
# View logs
pm2 logs goatbot-ig
# Stop bot
pm2 stop goatbot-ig
# Restart bot
pm2 restart goatbot-igGoatBot-IG-Port/
βββ ig-chat-api/ # Instagram Chat API (FCA-compatible)
β βββ api/ # API methods (sendMessage, listen, etc.)
β βββ utils/ # Helper functions
β βββ index.js # Main IG-FCA entry point
βββ scripts/
β βββ cmds/ # All bot commands
β β βββ help.js
β β βββ balance.js
β β βββ daily.js
β β βββ ...
β βββ events/ # Event handlers
β βββ welcome.js
β βββ leave.js
β βββ ...
βββ bot/
β βββ handler/ # Message and event handlers
β βββ login/ # Login and authentication
βββ database/
β βββ controller/ # Database controllers
β βββ models/ # Database models
βββ platform/
β βββ ig-wrapper.js # Instagram platform adapter
βββ .env # Environment variables (create this)
βββ config.json # Bot configuration
βββ configCommands.json # Command settings
βββ index.js # Main entry point
βββ InstagramGoat.js # Instagram bot core
βββ package.json # Dependencies
Problem: Send !help but bot doesn't reply
Solutions:
- Check bot is running:
Console should show "LISTEN" message - Verify prefix: Default is
!, checkconfig.json - Ensure DM is open: Bot must receive message first
- Check admin permissions: Some commands are admin-only
Problem: Error: Invalid session or login fails
Solutions:
- Delete
session.jsonfile - Restart bot with fresh credentials
- Complete any Instagram challenges
- Use Instagram Graph API method instead
Problem: Error: Cannot find module 'xyz'
Solutions:
# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install
# Or install specific module
npm install xyzProblem: Error: Permission denied
Solutions:
# Fix file permissions
chmod +x index.js
chmod -R 755 .
# Or run with appropriate permissions
sudo npm start # Not recommended on ReplitProblem: Error: Port 5000 is already in use
Solutions:
- Change port in
.env:PORT=3000
- Or kill existing process:
# Find process on port 5000 lsof -i :5000 # Kill it kill -9 <PID>
Problem: Commands loaded: 0 in console
Solutions:
- Check
scripts/cmds/folder exists - Ensure
.jsfiles are present - Check file permissions
- Review console for error messages
Problem: Error: Database connection failed
Solutions:
- Delete
database/data/*.jsonfiles - Restart bot to regenerate database
- Switch database type in
config.json:{ "database": { "type": "sqlite" // or "json" } }
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m 'Add feature' - Push to branch:
git push origin feature-name - Open a Pull Request
- Follow existing code style
- Test commands before submitting
- Update documentation for new features
- Keep commits atomic and descriptive
- Author: NTKhang (NTKhang03)
- Repository: GoatBot-V2
- License: MIT
- Ported by: Gtajisan
- IG-FCA API: Custom Instagram Chat API adapter
- Repository: GoatBot-IG-Port
- GoatBot V2 community
- Instagram Graph API documentation
- All contributors and testers
This project is licensed under the MIT License - see the LICENSE file for details.
- β Free to use, modify, and distribute
- β Can be used commercially
- β Must include original copyright notice
- β Cannot claim as original work
- β Cannot remove author credits
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: Support via GitHub only
- This bot uses unofficial Instagram methods
- Use at your own risk
- Author not responsible for account bans
- Recommended to use test/secondary accounts
- Follow Instagram's Terms of Service
- Do not spam or violate community guidelines
Made with β€οΈ by Gtajisan
Based on GoatBot V2 by NTKhang
β Star this repo if you find it useful! β