Triggering

Programmatically dispatch a task execution from your application code.

Quick Example

import { PingbackClient } from "@usepingback/next";

const pingback = new PingbackClient({ apiKey: process.env.PINGBACK_API_KEY });

// Trigger a task with a payload
await pingback.trigger("send-email", {
  to: "user@example.com",
  subject: "Welcome!",
});

HTTP API

POST /api/v1/trigger Authorization: Bearer <PINGBACK_API_KEY> Content-Type: application/json

Request Body

{
  "task": "send-email",
  "payload": { "to": "user@example.com" },
  "delay": "15m"
}
FieldTypeRequiredDescription
taskstringYesName of a registered task in your project.
payloadanyNoJSON payload passed to the task handler.
delaynumber | stringNoDelay before execution. See Delayed Triggers.

Response

{
  "executionId": "550e8400-e29b-41d4-a716-446655440000",
  "task": "send-email",
  "scheduledAt": "2026-04-27T15:15:00.000Z"
}

Error Responses

StatusDescription
400Invalid delay format or delay exceeds 30 days.
401Invalid or missing API key.
404Task name not found in your project.

SDK Methods

Each SDK wraps this API:

SDKMethod
Next.jspingback.trigger(taskName, payload?, options?)
NestJSthis.pingback.trigger(taskName, payload?, options?)
Gopb.Trigger(ctx, taskName, payload, opts...)
Pythonpb.trigger(task_name, payload, delay)

Note: Tasks can also be triggered manually from the Pingback dashboard. Navigate to your task and click "Run" to dispatch it with a custom payload.