What are Webhooks?
You may have heard that Zype's Streaming Platform is webhook enabled. But if you’ve never used webhooks that likely brings up a few questions. What are webhooks? And who uses webhooks? We explain more about webhooks below so you can take advantage of this powerful, easy-to-use tool.
What Are Webhooks? An Overview of the Basics
Let’s keep this simple. A webhook is a way for one application to send information to another. As an analogy, imagine your friend is asking people to subscribe to your video channel. You’d like to send an email to everyone who subscribes.
You’d need to know when people subscribe. You could periodically call your friend to check, but that’s inefficient. A better option would be your friend calling you when they sign up a new subscriber. They might say, “Someone subscribed! His name is Joe Shmo, firstname.lastname@example.org.” You say “Thanks,” and now you have everything you need to send Joe an email. That’s a webhook.
In the real world, webhooks are automatic, web-based applications. In the analogy, your friend is the trigger application. You’re the action application.
The trigger application in this scenario would be your video hosting platform — Zype, for example. The action application might be a mailing list – say MailChimp. Joe subscribes to your channel, and that event triggers Zype to send his information to MailChimp. MailChimp receives this information — called a request — and automatically sends Joe an email, which could be anything from a product offer to a simple thank you.
These are referred to as real-time notifications or automatic event updates, and they’re the heart of this kind of automation. Of course, none of this happens magically — you need to set both apps up to do it.
Implementing webhooks takes two basic steps: tell the trigger app what to do and tell the action app what to do. The trigger app needs three things:
- An event to watch for (subscription created)
- What information to send (Joe’s name and email)
- Where to send the information (URL location of the action app — something like https://mailchimp.com/actionapp/1234)
Next, your action app needs to know what to do with the information. Zype contacts MailChimp and says, “Subscription created: Joe Shmo, email@example.com.” MailChimp responds with a “success” message (HTTP status code 302) or a “fail” message (404). Then it gets to work, sending a preset email from a template you already created.
It’s up to the developers of applications to determine what you can do with webhooks. Trigger apps have a set of predetermined events and data they can send. You simply pick an event and tell it the URL of your action app.
For example, the Zype platform can send information in response to “consumer-created,” “subscription-created,” and “transaction-created” events, for starters. (If you’re a developer, there’s even more you can do with APIs and events on Zype).
Your action application will need to be equipped to receive and process webhooks. The app’s documentation will help you configure webhook actions.
What’s the Difference Between APIs and Webhooks?
You may have heard of an API or application programming interface. These are full-fledged programs that interface directly with other web-connected applications and often bridge the gap between one app and another. For example, an API might poll an online game to get recent high scores, then put the pertinent data into a database application to display recent high scores on a web page whenever it refreshes.
Webhooks are simpler. Technically they’re APIs. However, they only do one automated task, and they’re built into the trigger and action apps. Of course, if you are a developer and you want to create APIs to interact with Zype, you can.
Why Use Webhooks in Video Streaming?
When it comes to video, webhooks are an amazing way to keep track of things that happen in your video streaming application.
There are many ways that you can use webhooks in video streaming applications. For example, they can help you keep track of events, such as when a user starts or stops watching a stream, or even when a stream ends. Webhooks can also send notifications about errors occurring during playback or if a viewer lost connection. This information can be crucial to improving your video streaming and offering a better experience for the viewers.
Webhooks can also be very useful for automating some of your backend operations. Let's say one of your team adds a new video to your video CMS. You can set up a webhook to trigger updates to a consumer-facing application. For example, when you add a new video, a notification could be sent to your subscribers advising them there is new content to view.
Here are some other examples of how you can use webhooks in video streaming applications:
- Sending notifications when someone starts watching your stream
- Updating your CMS/CRM database with information about who is watching your stream
- Displaying different content to viewers based on their location
- Creating a custom chatbot for your live stream
How to Use Webhooks in Video Streaming
There are many different ways to implement webhooks in a video streaming application. The specific implementation will depend on the platform that you are using, as well as the language that your application is written in.
In general, however, there are three main steps:
- Configure the webhook URL: The first step is to configure the URL of the service that will receive the notifications. You can do this in the video streaming platform's settings or your application's code.
- Register the webhook: The next step is to register the webhook with the video streaming platform. You can usually do this through an API call or by providing the URL to the platform's webhooks registration page.
Test the webhook: Once the webhook is registered, you can test it by triggering an event in your video streaming application. For example, you can start, stop, or end a stream. If everything is working correctly, you should see the notification appear in the service you configured in the first step.
Take Advantage of Webhooks with Zype’s Streaming Platform
If you want to see for yourself how powerful webhooks can be with Zype, contact us today for your free demo of Zype's Streaming Platform, and find out just how far you can take your content.