webhook

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: MIT Imports: 7 Imported by: 0

README

Webhook Layanan WhatsAuth

WebHook Menggunakan method HTTP POST dengan Header bernama Secret
image
Format JSON dalam body yang dikirim ke WebHook :
image
Lengkapnya :

{
  "phone_number": "1234567890",
  "reply_phone_number": "0987654321",
  "chat_number": "1122334455",
  "chat_server": "server1.chat.example",
  "group_name": "Example Group",
  "group_id": "G-123456",
  "group": "yes",
  "alias_name": "JohnDoe",
  "messages": "This is a test message",
  "from_link": true,
  "from_link_delay": 30,
  "is_group": true,
  "filename": "document.pdf",
  "filedata": "base64EncodedString",
  "latitude": 37.7749,
  "longitude": -122.4194,
  "liveloc": true
}

Contoh Source Code WebHook

Berikut ini adalah contoh source code webhook

  1. Untuk Go di Google Cloud Funtion
  2. Untuk PHP di Web Hosting

Release Package

go get -u all					#update existing package
go mod tidy					#generate go mod
git tag                                 	#check current version
git tag v0.0.3                          	#set tag version
git push origin --tags                  	#push tag version to repo
go list -m github.com/whatsauth/webhook@v0.0.3   #publish to pkg dev, replace ORG/URL with your repo URL

Documentation

Index

Constants

View Source
const WAKeyword = "wh4t5auth0"

Variables

View Source
var WAAPIToken = os.Getenv("TOKEN")
View Source
var WebhookSecret = os.Getenv("SECRET")

Functions

func HandlerIncomingMessage

func HandlerIncomingMessage(msg model.IteungMessage) (resp atmessage.Response)

func HandlerQRLogin

func HandlerQRLogin(msg model.IteungMessage, WAKeyword string) (resp atmessage.Response)

func PostMessage

func PostMessage(c *fiber.Ctx) error

Types

type Header struct {
	Secret string `reqHeader:"secret"`
}

type Reply

type Reply struct {
	Message string `bson:"messsage"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL