A library for building interactive apps to engage with customers over the whatsapp business platform. Built ontop of the WhatsApp Cloud API provided by Meta technologies. Learn more about it here.
We are currently 🛠️ Under construction. Our focus is on stabilizing core features, ensuring code quality through automated auditing, and gathering community feedback.
- Complete project structure plus basic methods (read message, mark message as read, add text, etc)
- Standardize contribution process and implement basic CI/CD.
- Automated Go Linting (Static Analysis)
- Publish beta on go packages.
- Add other methods for first release (In Progress)
- Add demo project utilizing library (In Progress)
- Publish tutorial.
- Accept contributions.
- Publish first release v1.0.0: Release library for community feedback
Note: This roadmap is a living document and will be updated based on community feedback and project evolution.
go get github.com/mwprogrammer/flowCreate a Meta developer account and register a new app with Meta. Follow the directions here and here.
Define your flow settings by specifying your Whatsapp business Account Id, The API version (24 is the default), your Access Token (Temporary or Permanent) and the Sender Phone Number ID.
flow_settings := flow.FlowSettings{
Id: "XXXXXX", // Whatsapp Business Account ID
Version: "24.0", // Whatsapp Cloud API version
Token: "XXXXXX", // Access Token
Sender: "XXXXXXX", // Sender Phone Number Id
}Initialize a new Flow Object with the settings you created. You now have access to Flow methods which enable you to interact with users over the Whatsapp Business Platform.
flow_app := flow.New(flow_settings)After setting up your webhook, read incoming messages from receipients.
sample_json := `{"object":"whatsapp_business_account","entry":[{"id":"0","changes":[{"field":"messages","value":{"messaging_product":"whatsapp","metadata":{"display_phone_number":"16505551111","phone_number_id":"123456123"},"contacts":[{"profile":{"name":"test user name"},"wa_id":"16315551181"}],"messages":[{"from":"16315551181","id":"ABGGFlA5Fpa","timestamp":"1504902988","type":"text","text":{"body":"this is a text message"}}]}}]}]}`
message, err := new_flow.ParseMessage(sample_json)Mark a message as ready by specifying the receipient phone and messageId.
err := flow_app.MarkAsRead("26588293345", "XXXXXXXXXX")Display that the app is typing by specifying the receipient phone and messageId.
err := flow_app.DisplayTypingIndicator("26588293345", "XXXXXXXXXX")Send text messages to users by specifying the receipient phone number, the message and if the message includes a link, whether or not to display the preview.
err := flow_app.ReplyWithText("26588293345", "Hello", false)