wapi

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2025 License: Apache-2.0 Imports: 6 Imported by: 3 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Business  business.BusinessClient     // Business is the business client.
	Messaging []messaging.MessagingClient // MessagingClient is the messaging client.
	// contains filtered or unexported fields
}

func New

func New(config *ClientConfig) *Client

func (*Client) GetWebhookGetRequestHandler

func (client *Client) GetWebhookGetRequestHandler() func(c echo.Context) error

GetWebhookGetRequestHandler returns the handler function for handling GET requests to the webhook.

func (*Client) GetWebhookPostRequestHandler

func (client *Client) GetWebhookPostRequestHandler() func(c echo.Context) error

GetWebhookPostRequestHandler returns the handler function for handling POST requests to the webhook.

func (*Client) Initiate

func (client *Client) Initiate() bool

InitiateClient initializes the client and starts listening to events from the webhook. It returns true if the client was successfully initiated.

func (*Client) NewMessagingClient

func (client *Client) NewMessagingClient(phoneNumberId string) *messaging.MessagingClient

func (*Client) On

func (client *Client) On(eventType events.EventType, handler func(events.BaseEvent))

OnMessage registers a handler for a specific event type.

type ClientConfig

type ClientConfig struct {
	BusinessAccountId string
	ApiAccessToken    string
	WebhookSecret     string `validate:"required"`

	// these two are not required, because may be user want to use their own server
	WebhookPath       string
	WebhookServerPort int
}

Jump to

Keyboard shortcuts

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