Installation and setup | laravel-webhook-server-go | Spatie       

 SPATIE  

laravel-webhook-server-go
=========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-webhook-server-go](https://spatie.be/docs/laravel-webhook-server-go/v1)  Installation and setup

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-webhook-server-go/v1) 

  Installation and setup    
- [ Introduction ](https://spatie.be/docs/laravel-webhook-server-go/v1/introduction)
- [ Installation and setup ](https://spatie.be/docs/laravel-webhook-server-go/v1/installation-and-setup)
- [ Sending webhooks ](https://spatie.be/docs/laravel-webhook-server-go/v1/sending-webhooks)
- [ Signing requests ](https://spatie.be/docs/laravel-webhook-server-go/v1/signing-requests)
- [ Retrying failed webhooks ](https://spatie.be/docs/laravel-webhook-server-go/v1/retrying-failed-webhooks)
- [ Transport options ](https://spatie.be/docs/laravel-webhook-server-go/v1/transport-options)
- [ Events ](https://spatie.be/docs/laravel-webhook-server-go/v1/events)
- [ Testing webhooks ](https://spatie.be/docs/laravel-webhook-server-go/v1/testing-webhooks)
- [ Differences from PHP ](https://spatie.be/docs/laravel-webhook-server-go/v1/upgrading)
- [ Testing ](https://spatie.be/docs/laravel-webhook-server-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-webhook-server-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/laravel-webhook-server-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/laravel-webhook-server-go/v1/support-us)

 Installation and setup
======================

###  On this page 

1. [ Configure a queue worker ](#content-configure-a-queue-worker)

This version requires Go 1.27 or newer and Laravel Go `go.laravel.com v0.1.0`.

Install the module:

```
go get github.com/spatie/laravel-webhook-server-go@v0.1.0
```

Install the package explicitly in `bootstrap/app.go`:

```
import (
    webhookserver "github.com/spatie/laravel-webhook-server-go"
    laravel "go.laravel.com"
)

func Options() laravel.Options {
    return laravel.Options{
        Packages: []laravel.Package{webhookserver.New(func(cfg *webhookserver.Config) {
            cfg.Queue = "webhooks"
            cfg.Tries = 5
        })},
    }
}
```

Adding the module alone does not activate the package. There is no configuration publishing step or package-tools dependency.

Callbacks run after environment defaults. Each registration creates fresh application-scoped state. Configure replacement signers, serializers, jobs and backoffs on every web and worker process. Do not try to replace the service by registering another value of the same type. Laravel Go v0.1.0 returns the first matching service.

See [Config and Options](https://pkg.go.dev/github.com/spatie/laravel-webhook-server-go#Config) for all settings. The environment defaults are:

VariableDefault`WEBHOOK_SERVER_QUEUE``default``WEBHOOK_SERVER_CONNECTION`Application default`WEBHOOK_SERVER_HTTP_VERB``POST``WEBHOOK_SERVER_TRIES``3``WEBHOOK_SERVER_TIMEOUT_IN_SECONDS``3``WEBHOOK_SERVER_SIGNATURE_HEADER``Signature``WEBHOOK_SERVER_ID_HEADER``Webhook-Id`, empty disables it`WEBHOOK_SERVER_TIMESTAMP_HEADER``Timestamp``WEBHOOK_SERVER_RESPECT_RETRY_AFTER``false``WEBHOOK_SERVER_RETRY_WITH_JITTER``false``WEBHOOK_SERVER_THROW_EXCEPTION_ON_FAILURE``false``WEBHOOK_SERVER_VERIFY_SSL``true``WEBHOOK_SERVER_PROXY`UnsetInvalid typed environment values stop application startup. Other defaults include JSON Content-Type, the default HMAC signer, exponential backoff, all unsuccessful statuses retryable, no timestamp, no tags and certificate verification enabled.

Configure a queue worker
--------------------------------------------------------------------------------------------------------------------------------

Use a real queue connection, such as `database` or `redis`, in production. Set up the connection according to [Laravel Go's queue documentation](https://laravel.com/go/docs/queues). Database queues require Laravel's `queue.CreateTables` migration in the host application. Run a worker:

```
laravel queue:work
```

The `sync` connection does not wait or loop through delayed retries. The package schedules retries using Laravel's delayed queue jobs.

Choose a queue and connection globally using `cfg.Queue` and `cfg.Connection`, or override them per call:

```
id, err := webhookserver.From(ctx).Call("https://other-app.com/webhooks").
    Payload(map[string]string{"event": "order.created"}).Secret("your-shared-secret").
    Configure(func(o *webhookserver.Options) {
        o.Connection = "redis"
        o.Queue = "webhooks"
    }).Dispatch(ctx)
```

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
