Learn how to return transcripts to a callback URL sent to Quickreel’s API.

When working with the Quickreel API, you can use a callback to return your response to a URL on your server.

In this guide, you will learn how to use Quickreel’s webhook to return a response generated by Quickreel’s API to a callback URL that you provide.

What is a Webhook?

When using a web application, you often change the information being displayed on the web page you’re on. For example, while browsing a list of blog posts, you may click on a link to show more posts. When you do this, the web application’s UI on your machine (client) sends an HTTP request to the application’s server. The server then sends a response back to your device, which then triggers a change in the UI of the web application.

But when a web application’s server wants to trigger an event based on something that’s happening on a remote server instead of a user action, we use webhooks.

A webhook is a ‘reverse HTTP request’ between servers rather than between a client and a server. A remote server (Quickreel) sends an HTTP POST request to a public URL on your application’s server every time an event occurs on their end, so you can trigger an event in your own application based on that update.

Waiting for a Response

When requesting a response from Quickreel, you can wait for it to be generated, but this can take a few more seconds than you might be able to wait for larger files. Instead, you can access Quickreel’s webhook by including the callback feature in your request, which will allow you to redirect any response results to the URL of your choice.

Use Cases

Because you control the application that receives the webhook payload, you can build any additional business logic to run once you have data. You might:

  • Send an email to your client to let them know that their response is complete with the results.
  • Translate the response provided to your server to be displayed on your application’s UI.
  • Send an SMS text to the user’s phone with a brief preview of the results.

Prepare to Receive Incoming Transcripts on Your Server

To receive incoming response on your server, you need to create a webhook consumer in your application. Your webhook consumer is basically a route handler, but instead of receiving requests from a user action, it is triggered by the service emitting webhooks—in this case Quickreel.

Since webhooks send a POST request to your application, your webhook consumer will need to create a POST route handler in your application. So the webhook consumer receiving transcripts on your server might look something like this:


// Require, initialize, and configure Express
const express = require("express");
const app = express();
app.use(express.json());

// This is the route handler our webhook will POST data to
app.post("/hook", (req, res) => {
    /*
        You could do anything here, such as:
        Add data to a database
        Trigger an email or SMS
        Automatically schedule an event on your application's UI
    */

    console.log(req.body); // See the data
    res.status(200).end(); // Return empty response to server
});

// Start express server
app.listen(3000);

Send a Request to Quickreel

To send a request to Quickreel and receive the response on your server, you need to provide your webhook consumer’s URL in the request to Quickreel. You do that by using Quickreel’s Callback feature.

for example, run the following cURL command in a terminal or your favorite API client:

curl --location 'https://qr-be-api-vvafsac2oa-uc.a.run.app/api/request/videos/AIclip' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data '{
  "videoUrl": "https://www.youtube.com/watch?v=6jJ1Q0uyfP8&ab_ci",
  "callBackUrl": "https://your-server-url.com/hook"
}'

We will then process your request asynchronously and return the response to your server through the callback URL you provided. If the HTTP status code of the response to the callback POST request is unsuccessful (not 200-299), Quickreel will retry the callback up to 10 times with a 30 second delay between attempts.