ahmadyusri / go-whatsapp-fiber

Go WhatsApp REST API Implementation Using Fiber And Swagger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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
  • Swag - converts Go annotations to Swagger Documentation 2.0
  • Make - Automated Execution using Makefile

Optional package:

  • gosec Golang Security Checker. Inspects source code for security problems by scanning the Go AST

Config

  1. Rename .env.example to .env
  2. fill it environment with your make setting.

Running On Docker Container

  • Run project by using following command:
$ make run

# Process:
#   - Generate API docs by Swagger
#   - Build and run Docker containers
  • Stop application by using following command:
$ make stop

# Process:
#   - Stop and remove app container
#   - remove image
  • Run Container without Rebuid by using following command:
$ make docker_run_image

# Process:
#   - Run Docker containers, if image not found will build image

Running On Local Machine

Below is the instructions to run this project on your local machine:

  1. Open new terminal.
  2. Set run.sh file permission.
$ chmod +x ./run.sh
  1. 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 and fill Basic Auth with BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD, let BASIC_AUTH_USERNAME and BASIC_AUTH_PASSWORD empty if you want without basic auth
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 .env environment setting if an error occurred.
  • Scant it, and done. Now you can perforn 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

More


About

Go WhatsApp REST API Implementation Using Fiber And Swagger


Languages

Language:Go 96.3%Language:Shell 2.0%Language:Dockerfile 0.9%Language:Makefile 0.7%