Visit the documentation of the SDK here
Beta Version - This SDK is not stable right now. It is currently in beta version. Report issues here.
This SDK is part of a technical suite built to support the WhatsApp Business Application Development ecosystem. This SDK also has a Node.js version, you can check it out here.
Wapi.go is a Golang SDK, that supports WhatsApp API products i.e., Business Management API and Cloud API to build WhatsApp applications easily. This SDK supports managing WhatsApp business accounts, and managing phone numbers for a WhatsApp business account which includes creating, verifying, and registering a phone number to use for messaging via cloud API and deregistering a phone number. This SDK also supports the management of message templates which includes creating new templates or updating/deleting the existing ones.
You can listen to the incoming webhook events via the inbuilt standalone HTTP server built using echo and also you can integrate the SDK within your existing backend applications using the getters for the route handlers of the webhook server.
- Supports multiple phone number messaging clients.
- Supports WhatsApp
- Send Messages with the least configuration
- Event Listener for Notifications (support both User and System Notifications) and all the events provided by the WhatsApp Business Platform.
- Manage Phone numbers and messaging templates right from the SDK programmatically.
- Upload Media to WhatsApp servers
- Reply and React to incoming messages.
This assumes you already have a working Go environment, if not please see this page first.
go get
will always pull the latest tagged release from the master branch.
go get github.com/sarthakjdev/wapi.go
Note: This SDK is not affiliated with the official WhatsApp Cloud API or does not act as any official solution provided the the Meta Inclusive Private Limited, this is just a open source SDK built for developers to support them in building whatsapp cloud api based chat bots easily.
You can check out the example WhatsApp bot here. Example Chatbot
Import the package into your project. This repository has three packages exported:
- github.com/sarthakjdev/wapi.go/components
- github.com/sarthakjdev/wapi.go/wapi/wapi
- github.com/sarthakjdev/wapi.go/wapi/business
- github.com/sarthakjdev/wapi.go/wapi/events
import "github.com/sarthakjdev/wapi.go/wapi/wapi"
Construct a new Wapi Client to access the managers in order to send messages and listen to incoming notifications.
whatsappClient, err := wapi.New(wapi.ClientConfig{
PhoneNumberId: "",
ApiAccessToken: "",
BusinessAccountId: "",
WebhookPath: "/webhook",
WebhookSecret: "",
WebhookServerPort: 8080,
})
-
Message Structures: Refer to the WhatsApp Docs here.
-
Notification Payloads: Details can be found here.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
For detailed guidelines, check Contributing.md.
- Handle errors gracefully
- Handle template and interactive messages gracefully
- Add support for more interactive message types like address input.
Distributed under the AGPL 3.0 License. View LICENSE.
- Sarthak Jain
- Email: sarthak@softlancer.co
- Twitter | LinkedIn
Note: This SDK is part of an open-source product-building initiative by Softlancer, and this repository will soon be moved under the same organization.