Bot releases are visible (Hide)
Example:
package main
import (
"fmt"
"github.com/green-api/whatsapp-api-client-golang/pkg/api"
)
func main() {
Partner := api.GreenAPI{
PartnerToken: "gac.37ea41ed00d74bc7a0899215312fed55bfd9bcd03a1e48",
}
response, err := Partner.Methods().Partner().CreateInstance(map[string]interface{}{
"stateWebhook": "yes",
"incomingWebhook": "yes",
})
if err != nil {
fmt.Println(err)
}
fmt.Println(response)
}
https://github.com/green-api/whatsapp-api-client-golang/blob/master/examples/createInstance/main.go
Published by Amele9 10 months ago
Published by Amele9 10 months ago
Published by Amele9 10 months ago
Fixed docs
Fixed API method names
Updated MIMEType detection
Fixed #12
Now all library errors will be returned to you. A channel for tracking errors in the GreenAPIWebhook
structure has also been added.
Example of error handling when receiving or deleting incoming notifications:
go func() {
for {
select {
case err := <-GreenAPIWebhook.ErrorChannel:
fmt.Println(err.Error())
default:
<-time.After(time.Second)
}
}
}()
Published by Amele9 over 1 year ago
Published by Amele9 over 1 year ago
Published by Amele9 over 1 year ago
Published by Amele9 over 1 year ago
import cycle not allowed
package main
import (
"fmt"
"github.com/green-api/whatsapp-api-client-golang/pkg/api"
- "github.com/green-api/whatsapp-api-client-golang/pkg/webhook"
)
func main() {
GreenAPI := api.GreenAPI{
IDInstance: "1101000001",
APITokenInstance: "d75b3a66374942c5b3c019c698abc2067e151558acbd412345",
}
- GreenAPIWebhook := webhook.GreenAPIWebhook{
- GreenAPI: GreenAPI,
- }
+ GreenAPIWebhook := GreenAPI.Webhook()
GreenAPIWebhook.Start(func(body map[string]interface{}) {
fmt.Println(body)
})
}
Published by Amele9 over 1 year ago
GreenAPI.Webhook
function (You can use the Webhook structure directly from the GreenAPI structure)Published by Amele9 over 1 year ago
Published by ripreal almost 2 years ago