Products
Products
Video Hosting
Upload and manage your videos in a centralized video library.
Image Hosting
Upload and manage all your images in a centralized library.
Galleries
Choose from 100+templates to showcase your media in style.
Video Messaging
Record, and send personalized video messages.
CincoTube
Create your own community video hub your team, students or fans.
Pages
Create dedicated webpages to share your videos and images.
Live
Create dedicated webpages to share your videos and images.
For Developers
Video API
Build a unique video experience.
DeepUploader
Collect and store user content from anywhere with our file uploader.
Solutions
Solutions
Enterprise
Supercharge your business with secure, internal communication.
Townhall
Webinars
Team Collaboration
Learning & Development
Creative Professionals
Get creative with a built in-suite of editing and marketing tools.
eCommerce
Boost sales with interactive video and easy-embedding.
Townhall
Webinars
Team Collaboration
Learning & Development
eLearning & Training
Host and share course materials in a centralized portal.
Sales & Marketing
Attract, engage and convert with interactive tools and analytics.
"Cincopa helped my Enterprise organization collaborate better through video."
Book a Demo
Resources
Resources
Blog
Learn about the latest industry trends, tips & tricks.
Help Centre
Get access to help articles FAQs, and all things Cincopa.
Partners
Check out our valued list of partners.
Product Updates
Stay up-to-date with our latest greatest features.
Ebooks, Guides & More
Customer Stories
Hear how we've helped businesses succeed.
Boost Campaign Performance Through Video
Discover how to boost your next campaign by using video.
Download Now
Pricing
Watch a Demo
Demo
Login
Start Free Trial
Webhooks with api.video enable real-time communication between your application and the api.video platform. By automatically receiving updates on events like video uploads, encoding status, and live stream changes, you can streamline workflows, trigger custom actions, and enhance user experience without constant polling. Overview of Webhooks The first step in integrating webhooks with api.video is setting up an endpoint on your server that can receive and process HTTP POST requests. This endpoint will handle the incoming data sent by api.video whenever an event (like video upload or processing completion) occurs. Once the webhook is triggered, api.video will send the event data as a JSON payload to your endpoint. Your server will need to parse this data and perform actions based on the event type. Set Up a Webhook Endpoint The first step in using webhooks with api.video is to create an endpoint on your server capable of receiving and processing HTTP POST requests. The webhook data, which api.video sends, will be passed to this endpoint as a JSON payload. Example (Node.js/Express) : const express = require('express'); const bodyParser = require('body-parser'); const app = express(); const port = 3000; // Middleware to parse JSON payloads app.use(bodyParser.json()); // Webhook endpoint app.post('/api/webhook', (req, res) => { const eventData = req.body; console.log('Received Webhook Event:', eventData); // Process event (e.g., store in DB, trigger actions) res.status(200).send('Webhook received'); }); app.listen(port, () => { console.log(`Server running at http://localhost:${port}`); }); Explanation : app.post('/api/webhook', (req, res) => {...}); : Defines a POST route /api/webhook that listens for webhook events. The request body is captured and logged, and the server responds with a success message. console.log('Received Webhook Event:', eventData); : Logs the incoming webhook event data to the console for debugging or processing purposes. res.status(200).send('Webhook received'); : Sends a 200 OK response to api.video, confirming that the webhook was successfully received. app.listen(port, () => {...}); : Starts the server on the specified port and logs a message confirming the server is running. Register the Webhook with api.video After successfully setting up your webhook endpoint to handle incoming requests, the next step is to register the webhook with api.video . This ensures that api.video knows where to send event notifications whenever one of the specified events occurs. By registering the webhook, you're essentially telling api.video that you want to listen for certain events related to video lifecycle changes or other activities within your account. Example : curl -X POST https://api.api.video/v1/webhooks \ -H 'Authorization: Bearer YOUR_API_KEY' \ -d '{'url': 'https://yourdomain.com/api/webhook', 'events': ['video.uploaded', 'video.processing.completed']}' Explanation : curl -X POST https://api.api.video/v1/webhooks : Sends a POST request to the api.video API to register a new webhook. -H 'Authorization: Bearer YOUR_API_KEY' : Adds an Authorization header with the API key for authentication, allowing the request to access the api.video account. -d '{'url': 'https://yourdomain.com/api/webhook', 'events': ['video.uploaded', 'video.processing.completed']}' : Specifies the request body, defining the webhook URL and the events for which notifications will be sent. Handle Webhook Events After successfully setting up and registering the webhook, your endpoint will start receiving data when the specified events occur. api.video sends the event data as a JSON payload, which you can process according to your needs. Example : { 'event': 'video.uploaded', 'data': { 'videoId': 'your-video-id', 'status': 'uploaded', 'url': 'https://api.video.com/video/your-video-id', 'thumbnail': 'https://api.video.com/video/your-video-id/thumbnail.jpg', 'title': 'Sample Video' } } Explanation : Event : The type of event triggered by api.video . For example, 'video.uploaded' signifies that a video has been uploaded successfully. VideoId : Unique identifier for the video. Status : The current status of the video (e.g., 'uploaded'). Thumbnail : A URL pointing to the thumbnail image of the video. Secure Your Webhook To ensure that only api.video is sending data to your endpoint, you can use webhook secret headers. This allows you to verify that the incoming request is legitimate and comes from api.video. Example : const crypto = require('crypto'); const secret = 'your-webhook-secret'; const signature = req.headers['x-api-video-signature']; const payload = JSON.stringify(req.body); const hash = crypto.createHmac('sha256', secret) .update(payload) .digest('hex'); if (hash === signature) { console.log('Webhook verified'); } else { console.log('Invalid signature'); res.status(400).send('Invalid signature'); } Explanation : const crypto = require('crypto'); : Imports the crypto module to generate cryptographic hashes for verifying webhook signatures. const secret = 'your-webhook-secret'; : Defines the secret key used to verify the webhook signature. const signature = req.headers['x-api-video-signature']; : Retrieves the signature sent by api.video in the webhook header for verification. const payload = JSON.stringify(req.body); : Converts the webhook payload into a string format for hashing. const hash = crypto.createHmac('sha256', secret).update(payload).digest('hex'); : Generates a SHA-256 hash of the payload using the secret key to verify its integrity. if (hash === signature) {...} : Compares the generated hash with the signature; if they match, the webhook is verified. else { console.log('Invalid signature'); res.status(400).send('Invalid signature'); } : If the hash doesn't match the signature, the request is rejected with a 400 status code. Test the Webhook Before using your webhook in a production environment, it is essential to test the integration. Testing ensures that your webhook endpoint is correctly processing incoming data and that your server responds as expected to the events sent by api.video. You can test your webhook integration in 2 ways: Testing via api.video Dashboard: api.video provides a way to simulate and trigger test webhook events directly from the dashboard. This allows you to ensure your server processes the data properly before any actual events occur. Triggering Test Events via the api.video API : You can manually trigger test events through the api.video API. This can be useful to test specific scenarios, such as video uploads or processing completions. You can use api.video to test webhook integrations from the dashboard, or send test events via their API. After verifying the webhook, you can test the functionality by uploading a video or triggering other events to ensure that your system responds appropriately.