> ## Documentation Index
> Fetch the complete documentation index at: https://golang.wapikit.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Client

```go theme={null}
import "github.com/wapikit/wapi.go/pkg/client"
```

<a name="Client" />

## type Client

```go theme={null}
type Client struct {
    Business     business.BusinessClient     // Business is the business client.
    Messaging    []messaging.MessagingClient // MessagingClient is the messaging client.
    eventManager *manager.EventManager       // eventManager is the event manager.
    webhook      *manager.WebhookManager     // webhook is the webhook manager.
    requester    *request_client.RequestClient

    apiAccessToken    string
    businessAccountId string
}
```

<a name="New" />

### func New

```go theme={null}
func New(config *ClientConfig) *Client
```

<a name="Client.GetWebhookGetRequestHandler" />

### func (\*Client) GetWebhookGetRequestHandler

```go theme={null}
func (client *Client) GetWebhookGetRequestHandler() func(c echo.Context) error
```

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

<a name="Client.GetWebhookPostRequestHandler" />

### func (\*Client) GetWebhookPostRequestHandler

```go theme={null}
func (client *Client) GetWebhookPostRequestHandler() func(c echo.Context) error
```

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

<a name="Client.Initiate" />

### func (\*Client) Initiate

```go theme={null}
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.

<a name="Client.NewMessagingClient" />

### func (\*Client) NewMessagingClient

```go theme={null}
func (client *Client) NewMessagingClient(phoneNumberId string) *messaging.MessagingClient
```

<a name="Client.On" />

### func (\*Client) On

```go theme={null}
func (client *Client) On(eventType events.EventType, handler func(events.BaseEvent))
```

OnMessage registers a handler for a specific event type.

<a name="ClientConfig" />

## type ClientConfig

```go theme={null}
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
}
```
