This is a simple Golang template using Go Fibre as the base framework, and mongodb.com as database host. It is compatible with alwaysdata.com CI/CD deployment. Inside the folder .github/workflows, you might choose your cloud provider and remove the .template extension :
- fly.io: fly.yml
- alwaysdata.com: alwaysdata.yml
The first thing to do is prepare a Mongo database using this template:
- Sign up for mongodb.com and create one instance of Data Services of mongodb.
- Download MongoDB Compass, connect with your mongo string URI from mongodb.com
- Create database name iteung and collection reply

- Import this json into reply collection.



This boilerplate has several folders with different functions, such as:
- .github: GitHub Action yml configuration.
- URL: same as routes, this folder acts to route URL in the browser into the controller
- config: all apps configuration like database, API, token.
- controller: all of the endpoint functions
- model: all of the type structs used in this app
- helper: package folder with function only called by others
Sign Up for a 100MB plan Free for life in alwaysdata. Login into your dashboard and follow this instruction:
- Open the menu Web>Sites>Modify

- In the Configuration section edit command and Environment

Please set the environment variable in your system:In this menu, you will see an APPID in the title, shown as a number and a home folder used in the github secrets variable.MONGOSTRING=YOURMONGOSTRINGACCESS WAQRKEYWORD=yourkeyword WEBHOOKURL=https://yourappname.alwaysdata.net/whatsauth/webhook WEBHOOKSECRET=yoursecret WAPHONENUMBER=62811111
- Go to menu REmote Access>SSH>Modify, set a very strong password and tick enable password-based login
- Set APIKEY in Customer Area>Profile >Managing Tokens>Generate a token
- Add sshhost, sshusername, sshpassword, sshport, apikey, appid and folder in your GitHub secret>action variable

-
Go to the WhatsAuth signup page and scan with your WhatsApp camera menu for login.
-
Input the webhook URL(https://yourappname.alwaysdata.net/whatsauth/webhook) and your secret from the WEBHOOKSECRET setting environment on Always Data.

-
Follow this instruction, in the end of instruction you will get 30 days token using this request
-
Save the token into MongoDB, open iteung db, create a profile collection and insert this JSON document with your 30-day token and your WhatsApp number.


{ "token":"v4.public.asoiduas", "phonenumber":"6281111" }
To continue using WhatsAuth service, we must get new token every 3 week before token expired in 30 days.
- Open Menu Scheduled tasks> Add scheduled task

- Select Access to URLs, fill in the value with https://yourappname.alwaysdata.net/whatsauth/refreshtoken also your email address.

- Set Frequency every 3 weeks

If you want to upgrade apps, please delete (go.mod) and (go.sum) files first, then type the command in your terminal or cmd :
go mod init gocroot
go mod tidy

