import { Client } from "@upstash/workflow";
const client = new Client({ token: "<QSTASH_TOKEN>" })
const { workflowRunId } = await client.trigger({
url: "https://<YOUR_WORKFLOW_ENDPOINT>/<YOUR-WORKFLOW-ROUTE>",
body: "hello there!", // optional body
headers: { ... }, // optional headers
workflowRunId: "my-workflow", // optional workflow run id
retries: 3 // optional retries in the initial request
delay: "10s" // optional delay value
failureUrl: "https://<YOUR_FAILURE_URL>", // optional failure url
useFailureFunction: true, // whether a failure function is defined in the endpoint
flowControl: { ... } // optional flow control
keepTriggerConfig: true, // whether to keep the trigger config in all steps
})
console.log(workflowRunId)
// prints wfr_my-workflow