Pipedream wait for webhook callback from a Sume video run
Call $.flow.suspend() in the step that starts a Sume video run, pass resume_url as webhook_url, and Pipedream resumes when Sume POSTs the result.

To make a Pipedream workflow wait for a webhook callback from Sume, call $.flow.suspend() in the code step that starts the run and pass the returned resume_url as communication.webhook_url. Pipedream pauses at the end of that step and resumes the execution when Sume POSTs the run's result, which it does once, when the run completes or fails.
Sume has no Pipedream app; this is a Node.js code step calling the API over HTTPS. Sume facts come from Create a run, Runs and results, and Run webhooks; Pipedream behavior comes from Pipedream's docs, read 2026-09-27. The webhook contract is covered in Sume Format run lifecycle.
How does $.flow.suspend fit a Sume run?
Each Pipedream rule below has a direct consequence for the run.
| Pipedream rule | What it means for the run |
|---|---|
$.flow.suspend() returns resume_url and cancel_url. | Send resume_url as communication.webhook_url. |
| The workflow pauses at the end of the step. | Create the run inside that same step. |
| The URLs belong to one execution. | A new execution sends a new URL, so its request body is new too. |
Data sent to resume_url lands in the step's $resume_data export. | Sume's POST carries the run receipt. |
| A suspended workflow is canceled after 24 hours by default; the first argument sets a timeout in milliseconds. | Sume force-finalizes a run as failed 90 minutes after created_at. |
| Suspend works only in production, not when you test a step. | Test with a deployed workflow. |
What does the step that starts the run look like?
Keep the API key in a Pipedream environment variable, which defaults to secret, and read it with process.env; Pipedream advises against putting keys in workflow code. Derive the Idempotency-Key from the event, and return the run id for later steps. In current code the webhook URL is part of the body the key is checked against, and resume_url belongs to one execution, so the same key sent from a new execution gets 409 idempotency_conflict and no second run starts.
import axios from "axios";
export default defineComponent({
async run({ steps, $ }) {
const order = steps.trigger.event;
const { resume_url } = $.flow.suspend(2 * 60 * 60 * 1000); // 2 hours
const { data } = await axios({
method: "POST",
url: "https://api.sume.com/v1/formats/sume/sume-product-commercial/runs",
headers: {
Authorization: `Bearer ${process.env.SUME_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": `order-${order.id}-v1`,
},
data: {
instruction: "Make a vertical product commercial from the attached photo.",
attachments: [{ type: "input_image", image_url: order.photo_url }],
generation_spend_cap_usd: 20,
communication: { webhook_url: resume_url },
},
});
return { run_id: data.data.id };
},
});How long should the suspend timeout be?
Longer than the run can last. Sume force-finalizes a run as failed 90 minutes after created_at, and long-form host video typically finishes in 15 to 30 minutes, so the two hours above leave margin. The 24-hour default also works, but it holds the execution open for runs that will never call back: Sume sends nothing for a canceled or skipped run.
When the timeout passes, Pipedream cancels the workflow and the steps after the suspend never run, so keep the run id somewhere you can check it. Your timeout does not cancel the Sume run; it keeps running and billing.
What should the next step do with the callback?
Treat the callback as the signal to look, then read the run with your key, using the run id the first step returned: GET /v1/format-runs/{run_id} returns the same receipt Sume POSTed, in its data. That read is authenticated by your own key, so the workflow does not have to check Sume's signature on $resume_data.
completed: publishprimary_output_url, a durablemedia.sume.comURL.failed: readerror, andartifacts[]for anything the run made.- Requests to
resume_urlhave the same limits as any HTTP request to Pipedream, which answers413over its body limit. Sume inlines receipts up to 1 MiB, so check that limit if your runs return large receipts.
When should I poll with $.flow.rerun instead?
When you would rather not depend on the callback. $.flow.rerun(delay, context, maxRetries) reruns the step after delay milliseconds, up to maxRetries times, which defaults to 10, and Pipedream shows it polling an external job until it completes. A 10-minute delay with 10 retries spans 100 minutes, past Sume's 90-minute bound; after the last retry the workflow moves to the next step, which should read the run once more. Pipedream does not charge for the time a workflow is suspended by rerun or suspend.
Sources
- Create a run
- Format catalog
- Format API
- Runs and results
- Run webhooks
- Format cookbook
- Pipedream: Pause, Resume, and Rerun a Workflow (read 2026-09-27)
- Pipedream: Environment Variables (read 2026-09-27)
- Pipedream: Make HTTP Requests with Node.js (read 2026-09-27)
- Pipedream: Node.js code steps (read 2026-09-27)
- Pipedream: Triggers (read 2026-09-27)
Related posts
More in Integrations
- Power Automate HTTP request API: start and poll a Sume run
Call the Sume API from a Power Automate HTTP action: start a Format run, poll it in a Do until loop, and read the key from a Key Vault secret.
- Pydantic AI MCP server: give an agent Sume's hosted tools
Connect a Pydantic AI agent to Sume's hosted MCP server with MCPToolset and an API-key header, filter the tools, and hold paid calls for approval.
- Python webhook HMAC verification in FastAPI and Django
Verify a Sume webhook in Python: HMAC-SHA256 over timestamp.raw_body, split the signature header on commas, compare in constant time, answer fast.
- Shopify product video AI API with products/create webhooks
Answer Shopify's products/create webhook within five seconds, run a Sume Format from a queue, then upload the MP4 to Shopify with a staged upload.
Written by Sume