package module
Version: v0.0.0-...-bbe6a38 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 28 Imported by: 0


go-instadm : (WIP) Golang smart bot for Instagram DM

⚡ Powerful, customizable and easy to use Instagram dm bot. CLI and GUI interface! Using Selenium webdriver and Yaml configuration files.

Disclaimer: This is a research project. I am in no way responsible for the use you made of this tool. In addition, I am not responsible for any sanctions and/or limitations imposed on your account after using this bot.

Table of Contents


  • Go (v1.13+)


Check this Project to see all planned features for this tool! Feel free to suggest additional features to implement! 🥳


Comming soon


👤 Hugo Bollon

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

This project is under MIT license.




This section is empty.


This section is empty.


func DownloadDependencies

func DownloadDependencies(downloadBrowsers, downloadLatest, forceDl bool)

DownloadDependencies automate selenium dependencies downloading (ChromeDriver binary, the Firefox binary, the Selenium WebDriver JARs, and the Sauce Connect proxy binary)

func SimulateHandWriting

func SimulateHandWriting(element selenium.WebElement, input string) bool

SimulateHandWriting simulate human writing by typing input string character by character with random interruptions between letters


type Account

type Account struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`

Account store personnal credentials

type AutoDM

type AutoDM struct {
	Activated bool `yaml:"activated"`
	// List of all availlables message templates
	DmTemplates []string `yaml:"dm_templates"`
	// Greeting module add a customized DM header with recipient username
	Greeting struct {
		Activated bool `yaml:"activated"`
		// Add a string before the username
		Template string `yaml:"template"`
	} `yaml:"greeting"`

AutoDM store messaging module configuration

type BlacklistManager

type BlacklistManager struct {
	// BlacklistedUsers: list of all blacklisted usernames
	BlacklistedUsers [][]string
	// Activated: quota manager activation boolean
	Activated bool `yaml:"activated"`

BlacklistManager data

func (*BlacklistManager) AddUser

func (bm *BlacklistManager) AddUser(user string)

AddUser add argument username to the blacklist

func (*BlacklistManager) InitializeBlacklist

func (bm *BlacklistManager) InitializeBlacklist() error

InitializeBlacklist check existence of the blacklist csv file and initialize it if it doesn't exist.

func (*BlacklistManager) IsBlacklisted

func (bm *BlacklistManager) IsBlacklisted(user string) bool

IsBlacklisted check if the given user is already blacklisted

type BotConfig

type BotConfig struct {
	// User credentials
	UserAccount Account `yaml:"account"`
	// Automatic messages sending module
	DmModule AutoDM `yaml:"auto_dm"`
	// Quotas
	Quotas QuotaManager `yaml:"quotas"`
	// Scheduler
	Scheduler SchedulerManager `yaml:"schedule"`
	// Interracted users blacklist
	Blacklist BlacklistManager `yaml:"blacklist"`

BotConfig struct store all bot and ig related configuration . These parameters are readed from Yaml config files.

type ClientConfig

type ClientConfig struct {
	// LogLevel set loglevel threshold
	// If undefined or wrong set it to INFO level
	LogLevel logrus.Level
	// ForceDependenciesDl force re-download of all dependencies
	ForceDependenciesDl bool
	// Debug set selenium debug mode and display its logging to stderr
	Debug bool
	// IgnoreDependencies disable dependencies manager on startup
	IgnoreDependencies bool
	// Headless execute Selenium webdriver in headless mode
	Headless bool
	// Port : communication port
	Port uint16

	BotConfig BotConfig

ClientConfig struct centralize all client configuration and flags. Inizialized at program startup, not safe to modify this after.

func CreateClientConfig

func CreateClientConfig() *ClientConfig

CreateClientConfig create default ClientConfig instance and return a pointer on it

type CustomTime

type CustomTime struct {

CustomTime is a custom time.Time used to set a custom yaml unmarshal rule

func (*CustomTime) UnmarshalYAML

func (t *CustomTime) UnmarshalYAML(unmarshal func(interface{}) error) error

type QuotaManager

type QuotaManager struct {
	// HourTimestamp: hourly timestamp used to handle hour limitations
	HourTimestamp time.Time
	// DayTimestamp: daily timestamp used to handle day limitations
	DayTimestamp time.Time
	// DmSent: quantity of dm sent in the last hour
	DmSent int
	// DmSentDay: quantity of dm sent in the last day
	DmSentDay int
	// MaxDmHour: maximum dm quantity per hour
	MaxDmHour int `yaml:"dm_per_hour"`
	// MaxDmDay: maximum dm quantity per day
	MaxDmDay int `yaml:"dm_per_day"`
	// Activated: quota manager activation boolean
	Activated bool `yaml:"activated"`

QuotaManager data

func (*QuotaManager) AddDm

func (qm *QuotaManager) AddDm()

AddDm report to the manager a message sending. It increment dm counter and check if quotas are still valid.

func (*QuotaManager) CheckQuotas

func (qm *QuotaManager) CheckQuotas()

CheckQuotas check if quotas have not been exceeded and pauses the program otherwise.

func (*QuotaManager) InitializeQuotaManager

func (qm *QuotaManager) InitializeQuotaManager()

InitializeQuotaManager initialize Quota manager with user settings

func (*QuotaManager) ResetDailyQuotas

func (qm *QuotaManager) ResetDailyQuotas()

ResetDailyQuotas reset daily dm counter and update timestamp

func (*QuotaManager) ResetHourlyQuotas

func (qm *QuotaManager) ResetHourlyQuotas()

ResetHourlyQuotas reset hourly dm counter and update timestamp

type SchedulerManager

type SchedulerManager struct {
	// HourTimestamp: hourly timestamp used to handle hour limitations
	BeginAt CustomTime `yaml:"begin_at"`
	// DayTimestamp: daily timestamp used to handle day limitations
	EndAt CustomTime `yaml:"end_at"`
	// Activated: quota manager activation boolean
	Activated bool `yaml:"activated"`

SchedulerManager data

func (*SchedulerManager) CheckTime

func (s *SchedulerManager) CheckTime() error

CheckTime check scheduler and pause the bot if it's not working time

type Selenium

type Selenium struct {
	Instance  *selenium.Service
	Config    *ClientConfig
	Opts      []selenium.ServiceOption
	WebDriver selenium.WebDriver

Selenium instance and opts

func (*Selenium) CloseSelenium

func (s *Selenium) CloseSelenium()

CloseSelenium close webdriver and selenium instance

func (*Selenium) ConnectToInstagram

func (s *Selenium) ConnectToInstagram()

ConnectToInstagram get ig login webpage and connect user account

func (*Selenium) Fatal

func (s *Selenium) Fatal(msg string, err error)

Fatal closes all selenium stuff and call logrus fatal with error printing

func (*Selenium) GetElement

func (s *Selenium) GetElement(elementTag, locator string) (selenium.WebElement, error)

GetElement wait for element and then return when it is available

func (*Selenium) InitChromeWebDriver

func (s *Selenium) InitChromeWebDriver()

InitChromeWebDriver init and launch web driver with Chrome

func (*Selenium) InitFirefoxWebDriver

func (s *Selenium) InitFirefoxWebDriver()

InitFirefoxWebDriver init and launch web driver with Firefox

func (*Selenium) InitializeSelenium

func (s *Selenium) InitializeSelenium(clientConfig *ClientConfig)

InitializeSelenium start a Selenium WebDriver server instance (if one is not already running).

func (*Selenium) IsElementPresent

func (s *Selenium) IsElementPresent(by, value string) bool

IsElementPresent check if an element is present on the current webpage

func (*Selenium) SendMessage

func (s *Selenium) SendMessage(user, message string) (bool, error)

SendMessage navigate to Instagram direct message interface and send one to specified user by simulating human typing

func (*Selenium) WaitForElement

func (s *Selenium) WaitForElement(elementTag, locator string, delay int) (bool, error)

WaitForElement search and wait until searched element appears. Delay argument is in seconds.


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL