Regenerate a worker webhook token
client.Workers.Webhooks.RegenerateToken(ctx, workerID) (*Webhook, error)
POST/api/workers/{workerId}/webhook/regenerate-token
Issue a new shared token for the webhook, invalidating the previous one. The webhook URL is preserved. Only the worker creator can regenerate the token.
Regenerate a worker webhook token
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.RegenerateToken(context.TODO(), "t_org_123_w_01HZY2ZJQ8G7K42W2D7WF6V4GM")
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"
}