Skip to content

Gtajisan/GoatBot-IG-Port

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

GoatBot-IG-Port

GoatBot Instagram Port Banner

πŸ€– Instagram Chat Bot - Official Port of GoatBot V2

MIT License Node Version Instagram Platform

πŸ“– Introduction

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.

What's Different?

  • 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 API

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

✨ Features

Core Functionality

  • βœ… 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

Instagram-Specific Features

  • πŸ“± Works in Instagram DMs (1-on-1 chats)
  • πŸ‘₯ Works in Instagram group chats
  • πŸ”„ Auto-session refresh
  • πŸ›‘οΈ Checkpoint recovery system
  • ⚑ Fast message processing

Limitations

  • ❌ No dashboard (Instagram version)
  • ❌ Limited to Instagram Graph API capabilities
  • ⚠️ Group features depend on Instagram permissions

πŸš€ Installation Guide

Prerequisites

  • Node.js v16.0.0 or higher
  • Instagram Account (personal or business)
  • Git (for cloning)

Step 1: Clone the Repository

git clone https://github.com/Gtajisan/GoatBot-IG-Port.git
cd GoatBot-IG-Port

Step 2: Install Dependencies

npm install

Step 3: Create Environment File

add cookie arrya using Cookie editor add into account.txt

npm start 

# Bot Configuration

BOT_PREFIX=!
BOT_ADMIN_IDS=instagram_user_id_1,instagram_user_id_2

Step 5: Configure Bot Settings

Edit `config.json`:

```json
{
  "prefix": "!",
  "adminBot": ["your_instagram_user_id"],
  "language": "en",
  "database": {
    "type": "sqlite"
  }
}

πŸ“± Usage Guide

Starting the Bot

npm start

Expected Console Output

╔══════════════════════════════════════════════╗
β•‘          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

Using Commands

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

Prefix System

  • Default prefix: !
  • Change in config.json β†’ prefix
  • Per-thread prefix: !prefix <new_prefix>

Admin Permissions

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

πŸ” Login Guide

Method 1: Instagram Graph API (Recommended)

  1. Create Facebook App

  2. Get Access Token

    • Go to Tools β†’ Graph API Explorer
    • Select your app
    • Add permissions: instagram_basic, instagram_manage_messages
    • Generate token
  3. Get Page ID

    • Query: me?fields=instagram_business_account
    • Copy the instagram_business_account.id
  4. Configure Webhook

    • Set callback URL: https://your-replit-url.repl.co/webhook
    • Verify token: Same as INSTAGRAM_VERIFY_TOKEN in .env
    • Subscribe to: messages, messaging_postbacks
  5. Add to .account.txt

    your_token
    

Method 2: Session File (Legacy)

If you have an existing session.json:

  1. Place session.json in the root directory
  2. Bot will automatically load it on startup

Fixing Instagram Checkpoints

If Instagram asks for verification:

  1. Complete the challenge on Instagram app
  2. Clear session.json
  3. Restart bot with credentials
  4. New session will be generated

🌐 Deployment Guide

Deploy on Replit

  1. Import to Replit

    • Go to replit.com/new
    • Click "Import from GitHub"
    • Paste: https://github.com/Gtajisan/GoatBot-IG-Port
  2. Configure Secrets

    • Click "Secrets" (πŸ”’) in sidebar
    • Add all environment variables from .env.example
  3. Configure Run Command

    • The bot auto-detects and uses npm start
    • Or manually set in .replit file:
      run = "npm start"
      
  4. Deploy

    • Click "Run" button
    • For 24/7 hosting, click "Deploy" β†’ Choose deployment tier
    • Set run command: npm start
    • Enable auto-scaling if needed
  5. Set Webhook URL

    • Copy your Replit URL: https://your-repl-name.your-username.repl.co
    • Add /webhook to the end
    • Update webhook in Facebook Developer Console

Deploy on VPS/Termux

# 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 startup

Using PM2 (Optional)

Keep 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-ig

πŸ“ Project Structure

GoatBot-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

πŸ”§ Troubleshooting

Bot Not Responding to Commands

Problem: Send !help but bot doesn't reply

Solutions:

  1. Check bot is running: Console should show "LISTEN" message
  2. Verify prefix: Default is !, check config.json
  3. Ensure DM is open: Bot must receive message first
  4. Check admin permissions: Some commands are admin-only

Instagram Session Expired

Problem: Error: Invalid session or login fails

Solutions:

  1. Delete session.json file
  2. Restart bot with fresh credentials
  3. Complete any Instagram challenges
  4. Use Instagram Graph API method instead

Module Not Found Error

Problem: Error: Cannot find module 'xyz'

Solutions:

# Reinstall dependencies
rm -rf node_modules package-lock.json
npm install

# Or install specific module
npm install xyz

Permission Denied Errors

Problem: 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 Replit

Port Already in Use

Problem: Error: Port 5000 is already in use

Solutions:

  1. Change port in .env:
    PORT=3000
  2. Or kill existing process:
    # Find process on port 5000
    lsof -i :5000
    # Kill it
    kill -9 <PID>

Commands Not Loading

Problem: Commands loaded: 0 in console

Solutions:

  1. Check scripts/cmds/ folder exists
  2. Ensure .js files are present
  3. Check file permissions
  4. Review console for error messages

Database Errors

Problem: Error: Database connection failed

Solutions:

  1. Delete database/data/*.json files
  2. Restart bot to regenerate database
  3. Switch database type in config.json:
    {
      "database": {
        "type": "sqlite"  // or "json"
      }
    }

🀝 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Commit changes: git commit -m 'Add feature'
  4. Push to branch: git push origin feature-name
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style
  • Test commands before submitting
  • Update documentation for new features
  • Keep commits atomic and descriptive

πŸ“œ Credits

Original GoatBot V2

Instagram Port

Special Thanks

  • GoatBot V2 community
  • Instagram Graph API documentation
  • All contributors and testers

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

License Terms

  • βœ… Free to use, modify, and distribute
  • βœ… Can be used commercially
  • βœ… Must include original copyright notice
  • ❌ Cannot claim as original work
  • ❌ Cannot remove author credits

πŸ“ž Support

Get Help

Useful Links


⚠️ Disclaimer

  • 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! ⭐

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors