DEV Community

Cover image for Scheduling Workflows: POST, Poll, and Callback – Picking the Right One. Part 2.
Datapult
Datapult

Posted on

1

Scheduling Workflows: POST, Poll, and Callback – Picking the Right One. Part 2.

You have shifts, you have users, and you have rules that need strict adherence. How do you get from here to a schedule? Let’s dive into the two main options: posting data and waiting for a callback or posting and then polling. Both have strengths, depending on your application.

Callback

Callback are great for web-facing, low-latency environments, where users can afford to sit back and wait for the schedule to be ready.

Here is how to make Datapult call back to you once your schedule is ready: Simply add these to the payload:

{
  "callbackUrl": "https://www.yourdomain.app/custom_callback_url",
  "callbackAuthenticationHeaderName": "AnyHeaderYouWant",
  "callbackAuthenticationHeaderValue": "AnySecretYouWant"
}
Enter fullscreen mode Exit fullscreen mode

We will callback 3 times with exponential backoff and in case every callback yields a 5xx from you, we will send you an email with the error message that your server gave us. How helpful is that?

Polling

Maybe you are testing locally; maybe you cannot expose a route for us - for whatever reason callbacks are not possible - you can poll our servers for a solution. Here is how:

  1. Set the fields above to null or a dummy domain.
  2. POST your payload.
  3. The post message will return an integer id.
  4. Use this ID to GET /api/schedule/{id}. If you get a 204 No Content the payload is not ready. It will never take more than 10 minutes.
  5. Repeat step 4 until you get a 200.

Conclusion

While callbacks can reduce load your setup might not allow for it. Be using polling and done right, you can ensure a smooth UX to show progress. Both flows are supported and it’s up to you to configure according to your need.

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
🎥 Audio/video file upload with real-time preview
🗣️ Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍️ AI-powered article draft generation
📤 Export interview's subtitles in VTT format

Read full post

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay