Whatsapp Cloud API Wrapper for Golang

About

Lightweight Whatsapp Cloud API Wrapper v14.0 for Golang with no dependency.

Made this cause I haven’t found any reliable whatsapp cloud api wrapper for golang

Content

Instal

go get github.com/febriliankr/whatsapp-cloud-api

or if you want to use specific version

go get github.com/febriliankr/[email protected]

Usage

Create an instance of the Whatsapp Cloud API Client

wa := whatsapp.NewWhatsapp(token, myPhoneID)

Send a message with one parameter

parameters := wa.GenerateTemplateParameters("text", "48884")
components := wa.TemplateComponent("body", parameters)
request := wa.CreateSendTemplateRequest("RECEIVER_PHONE_NUMBER", "your_template_name", whatsapp.Indonesian, components)
res, err := wa.SendWithTemplate(request)

Send a message with no parameter

request := wa.CreateSendTemplateRequest("RECEIVER_PHONE_NUMBER", "your_template_name", whatsapp.Indonesian, nil)
res, err := wa.SendWithTemplate(request)

Check more usage example in example/example.go

Getting the Whatsapp Cloud API Access

Official documentation:

FAQ

Changing Whatsapp Cloud API version

wa := whatsapp.NewWhatsapp(token, myPhoneID)
wa.APIVersion = "v2"

Tutorial for Myself!

Releasing new version

$ git commit -m "hello: changes for v1.0.0"
$ git tag v1.0.0
$ git push origin v1.0.0

GitHub

View Github