Go WhatsApp REST API Implementation Using Fiber And Swagger
Package cooljar/go-whatsapp-fiber Implements the WhatsApp Web API using Fiber web framework,
and also Swag to generate Swagger Documentation (2.0).
This repository contains example of implementation Rhymen/go-whatsapp package.
Getting Started
These instructions will get you a copy of the project up and running on docker container and on your local machine.
Prerequisites
Prequisites package:
-
Docker - for developing, shipping, and running applications (Application Containerization).
-
Go - Go Programming Language
-
Make - Automated Execution using Makefile
Optional package:
-
gosec Golang Security Checker. Inspects source code for security problems by scanning the Go AST
Running On Docker Container
- Rename
Makefile.example
to Makefile
and fill it with your make setting.
- Run project by using following command:
$ make run
# Process:
# - Build and run Docker containers
Stop application by using following command:
$ make stop
# Process:
# - Stop and remove app container
# - remove image
Running On Local Machine
Below is the instructions to run this project on your local machine:
- Rename
run.sh.example
to run.sh
and fill it with your environment values.
- Open new
terminal
.
- Set
run.sh
file permission.
$ chmod +x ./run.sh
- Run application from terminal by using following command:
$ ./run.sh
API Access
Go to your API Docs page: 127.0.0.1:3000/swagger/index.html
API Docs page will be look like:
Below is the instructions to perform messaging:
- Make sure your computer is connected to the internet.
- Prepare your smartphone and make sure the internet is active.
- Hit the Login endpoint, you will see a QR Code if request was success.
Check your Makefile
setting if an error occurred.
- Scant it, and done.
Now you can perform all endpoint to send a message.
Testing
- Inspects source code for security problems using gosec. You need to install it first.
- Execute unit test by using following command:
$ make test
Built With
-
Go - Go Programming Languange
-
Go Modules - Go Dependency Management System
-
Make - GNU Make Automated Execution
-
Docker - Application Containerization
Authors
-
Fajar Rizky - Initial Work - cooljar
More