Skip to content

How to import the library and initiate your bot#


Don't forget to create a module:

go mod init example


go get

You can create an instance in console using link. Click create and select a plan. To start receiving incoming notifications, you need to configure your instance. Open console page via link. Select an instance from the list and click on it. Click Change. In Notifications category includes all webhooks that need to be received.

How to initialize an object#

To initiate a bot, you need to use the NewBot method from the library and specify the instance number and token from console.

bot := whatsapp_chatbot_golang.NewBot("INSTANCE_ID", "TOKEN")

Note that keys can be obtained from environment variables:

IDInstance := os.Getenv("ID_INSTANCE")
APITokenInstance := os.Getenv("API_TOKEN_INSTANCE")

List of examples#

Description Link to example
How to initialize a handler base.go
How to initialize a scene baseScene.go
Scene "Echo" echo.go
How to receive other types of notifications event.go
How to filter incoming messages filter.go
How to work with bot state state.go
Example of a ready-made chat bot full.go