Create a webhook
Register a URL we call when a followed event starts, a show airs or a channel's schedule changes.
Paid plansLive data
POSThttps://api.tvguideapi.com/v1/webhooks
Try itRuns the real call with your key
200 OK
Parameters
| Parameter | In | Type | Required | Description | Example |
|---|---|---|---|---|---|
| url | body | string | required | The HTTPS URL we call. | https://example.com/tv |
| events | body | list | required | Which events: schedule.changed, show.starting or event.starting. See Webhooks. | event.starting |
| filter | body | object | required | What to follow: channels, countries, shows, teams or leagues. Each event needs its own: channels or countries for schedule.changed, shows for show.starting, teams or leagues for event.starting. | {"teams":["arsenal"]} |
Request
curl -X POST -H "Authorization: Bearer $TVG_KEY" \
-H "Content-Type: application/json" -d '{"url":"https://example.com/tv","events":["event.starting"],"filter":{"teams":["arsenal"]}}' \
"https://api.tvguideapi.com/v1/webhooks"
$ch = curl_init("https://api.tvguideapi.com/v1/webhooks");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => '{"url":"https://example.com/tv","events":["event.starting"],"filter":{"teams":["arsenal"]}}',
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("TVG_KEY"), "Content-Type: application/json"],
]);
$answer = json_decode(curl_exec($ch), true);
const r = await fetch("https://api.tvguideapi.com/v1/webhooks", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.TVG_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({"url":"https://example.com/tv","events":["event.starting"],"filter":{"teams":["arsenal"]}}),
});
const { data, meta } = await r.json();
import os, requests
r = requests.post(
"https://api.tvguideapi.com/v1/webhooks",
headers={"Authorization": f"Bearer {os.environ['TVG_KEY']}"},
json={"url":"https://example.com/tv","events":["event.starting"],"filter":{"teams":["arsenal"]}},
)
data = r.json()["data"]
Sample response
{
"data": {
"id": "wh_3k21",
"url": "https://example.com/tv",
"events": [
"event.starting"
],
"filter": {
"teams": [
"arsenal"
]
},
"status": "active",
"secret": "whsec_9a41c0..."
},
"meta": {
"took_ms": 23
}
}