Skip to content
Get started

Update a worker webhook

client.Workers.Webhooks.Update(ctx, workerID, body) (*Webhook, error)
PUT/api/workers/{workerId}/webhook

Set or replace the webhook URL for a worker. A fresh token is generated the first time a URL is set; subsequent updates keep the existing token. Pass url: null to clear the webhook (use the dedicated DELETE for the same effect). Only the worker creator can update the webhook.

ParametersExpand Collapse
workerID string
body WorkerWebhookUpdateParams
UpdateWebhook param.Field[UpdateWebhook]
ReturnsExpand Collapse
type Webhook struct{…}
Token string

Shared secret sent in the X-Handinger-Token header on each delivery. null when no webhook is configured.

URL string

HTTPS endpoint that receives webhook deliveries when a task completes. null when no webhook is configured.

Update a worker webhook

package main

import (
  "context"
  "fmt"

  "github.com/ramensoft/handinger-go"
  "github.com/ramensoft/handinger-go/option"
)

func main() {
  client := handinger.NewClient(
    option.WithAPIKey("My API Key"),
  )
  webhook, err := client.Workers.Webhooks.Update(
    context.TODO(),
    "t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM",
    handinger.WorkerWebhookUpdateParams{
      UpdateWebhook: handinger.UpdateWebhookParam{
        URL: handinger.String("https://example.com/handinger-webhook"),
      },
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", webhook.Token)
}
{
  "token": "whk_01HZY31W2SZJ8MJ2FQTR3M1K9D",
  "url": "https://example.com/handinger-webhook"
}
Returns Examples
{
  "token": "whk_01HZY31W2SZJ8MJ2FQTR3M1K9D",
  "url": "https://example.com/handinger-webhook"
}