Webhook

Get notifications about events happening outside of the API request cycle.

By setting up webhooks, your server will be able to receive notifications about events happening outside of the API request cycle.

Configuring endpoints

You can set up webhook by going to the Webhook tab inside the Settings page on LiveAPI's dashboard. Then click Create new webhook and enter the URL that receives the notifications from LiveAPI.

25502550

Setting up webhook

Receiving events

LiveAPI will send a POST request to your URL configured in the previous step for every event supported. You can browse the supported events following each category here:

Example response

Here's an example of raw content:

{
  "event": "video-removed",
  "payload": {
    "_id": "6215dfa43a13b3c407dc05cb",
    "enabled": true,
    "user": "620e0ba1ce8f11ddde571d1c",
    "organization": "620e0ba2ce8f11ddde571d1d",
    "environment": "production",
    "lastUpdated": "2022-02-23T07:17:56.897Z",
    "creationTime": "2022-02-23T07:17:56.897Z"
  }
}

Video events

We currently support the following events for Video related actions:

For Videos:
video-created: LiveAPI has successfully created a video entity.

{
  "event": "video-created",
  "payload": {
    "enabled": true,
    "_id": "62273b7d39c4c6cf112b7d59",
    "user": "620e0ba1ce8f11ddde571d1c",
    "organization": "620e0ba2ce8f11ddde571d1d",
    "environment": "production",
    "platforms": [],
    "lastUpdated": "2022-03-08T11:18:21.534Z",
    "creationTime": "2022-03-08T11:18:21.534Z"
  }
}

video-downloaded: The file has been downloaded from a 3rd party URL and saved to the LiveAPI database.

{
  "event": "video-downloaded",
  "payload": {
    "inputUrl": "https://assets.liveapi.com/Sample_Video_LiveAPI.mp4"
  }
}

video-ready: All processing is done, video is ready for streaming.

{
  "event": "video-ready",
  "payload": {
    "_id": "62273bde41f880cf0ae8205b",
    "mediainfo": {
      "duration": "15.900",
      "track": [
        {
          "@type": "General",
          "VideoCount": "1",
          "AudioCount": "1",
          "FileExtension": "mp4",
          "Format": "MPEG-4",
          "FileSize": "2056899",
          "Duration": "15.900",
          "OverallBitRate_Mode": "VBR",
          "OverallBitRate": "1034918",
          "FrameRate": "30.000"
        },
        {
          "@type": "Video",
          "Format": "AVC",
          "Format_Profile": "Main",
          "Format_Level": "4.1",
          "CodecID": "avc1",
          "BitRate": "685883",
          "Width": "1920",
          "Height": "1080",
          "DisplayAspectRatio_String": "16:9",
          "FrameRate_Mode": "CFR",
          "FrameRate": "30.000"
        },
        {
          "@type": "Audio",
          "Format": "AAC",
          "CodecID": "mp4a-40-2",
          "BitRate": "317374",
          "Channels": "2",
          "ChannelPositions": "Front: L R",
          "SamplingRate": "48000"
        }
      ]
    }
  }
}

video-removed: Video has been deleted.

{
  "event": "video-removed",
  "payload": {
    "_id": "6215dfa43a13b3c407dc05cb",
    "enabled": true,
    "user": "620e0ba1ce8f11ddde571d1c",
    "organization": "620e0ba2ce8f11ddde571d1d",
    "environment": "production",
    "lastUpdated": "2022-02-23T07:17:56.897Z",
    "creationTime": "2022-02-23T07:17:56.897Z"
  }
}

Livestream events

We currently support the following events for Livestream related actions:
stream-created: New Livestream created.

{
  "event": "stream-created",
  "payload": {
    "config": {
      "password": "2ad45722"
    },
    "enabled": true,
    "_id": "62271544a94ae7c019a26737",
    "user": "620e0ba1ce8f11ddde571d1c",
    "key": "lv_ae1092309eba11ecb8c9dd019b1a0e66",
    "organization": "620e0ba2ce8f11ddde571d1d",
    "environment": "production",
    "platforms": [],
    "lastUpdated": "2022-03-08T08:35:16.376Z",
    "creationTime": "2022-03-08T08:35:16.376Z"
  }
}

stream-connected: Livestream connected.

{
  "event": "stream-connected",
  "payload": {
    "_id": "6226ce5f31ddbeb3754aa243",
    "enabled": true,
    "user": "620e0ba1ce8f11ddde571d1c",
    "organization": "620e0ba2ce8f11ddde571d1d",
    "environment": "production",
    "platforms": [
      {
        "_id": "6226ce8431ddbeb3754aa249",
        "template": "custom",
        "server": "rtmp://a.rtmp.youtube.com/live2",
        "key": "debs-4ux2-r565-1sv4-68zh",
        "enabled": true,
        "metaId": "98f05f63-5e69-4e9b-92e6-ece3e779e8f4",
        "creationTime": "2022-03-08T03:33:25.053Z"
      },
      {
        "_id": "6226d15f31ddbeb3754aa27b",
        "template": "custom",
        "server": "rtmp://a.rtmp.youtube.com/live2",
        "key": "debs-4ux2-r565-1sv4-444",
        "enabled": true,
        "metaId": "f9367c20-723d-4e4e-bc1f-3c0b6e1e6664",
        "creationTime": "2022-03-08T03:45:35.424Z"
      },
      {
        "_id": "6226d204acc1bbb37d2d66a2",
        "template": "custom",
        "server": "rtmp://a.rtmp.youtube.com/live100",
        "key": "debs-4ux2-r565-1sv4-68zh",
        "enabled": true,
        "metaId": "daa08775-14c7-4462-b06c-4b0f23e444da",
        "creationTime": "2022-03-08T03:48:20.926Z"
      }
    ],
    "lastUpdated": "2022-03-08T03:32:47.990Z",
    "creationTime": "2022-03-08T03:32:47.990Z"
  }
}

stream-disconnected: Livestream disconnected.

{
  "event": "stream-disconnected",
  "payload": {
    "_id": "6226ce5f31ddbeb3754aa243",
    "enabled": true,
    "user": "620e0ba1ce8f11ddde571d1c",
    "organization": "620e0ba2ce8f11ddde571d1d",
    "environment": "production",
    "platforms": [
      {
        "_id": "6226ce8431ddbeb3754aa249",
        "template": "custom",
        "server": "rtmp://a.rtmp.youtube.com/live2",
        "key": "debs-4ux2-r565-1sv4-68zh",
        "enabled": true,
        "metaId": "98f05f63-5e69-4e9b-92e6-ece3e779e8f4",
        "creationTime": "2022-03-08T03:33:25.053Z"
      },
      {
        "_id": "6226d15f31ddbeb3754aa27b",
        "template": "custom",
        "server": "rtmp://a.rtmp.youtube.com/live2",
        "key": "debs-4ux2-r565-1sv4-444",
        "enabled": true,
        "metaId": "f9367c20-723d-4e4e-bc1f-3c0b6e1e6664",
        "creationTime": "2022-03-08T03:45:35.424Z"
      },
      {
        "_id": "6226d204acc1bbb37d2d66a2",
        "template": "custom",
        "server": "rtmp://a.rtmp.youtube.com/live100",
        "key": "debs-4ux2-r565-1sv4-68zh",
        "enabled": true,
        "metaId": "daa08775-14c7-4462-b06c-4b0f23e444da",
        "creationTime": "2022-03-08T03:48:20.926Z"
      }
    ],
    "lastUpdated": "2022-03-08T03:32:47.990Z",
    "creationTime": "2022-03-08T03:32:47.990Z"
  }
}

stream-status-toggle: Livestream enabled/disabled.
If enabled, the webhook content will be:

{
  "event": "stream-status-toggle",
  "payload": {
    "_id": "621ddcf17e60d030791f7335",
    "enabled": true
  }
}

If disabled, the webhook content will be:

{
  "event": "stream-status-toggle",
  "payload": {
    "_id": "621ddcf17e60d030791f7335",
    "enabled": false
  }
}

stream-removed: Livestream deleted.

{
  "event": "stream-removed",
  "payload": {
    "_id": "621c8b9c5905e420ce607325",
    "config": {
      "password": "0c604bea"
    },
    "enabled": true,
    "user": "620e0ba1ce8f11ddde571d1c",
    "key": "lv_c071a610987211ecb547f15e6ab7cb2f",
    "organization": "620e0ba2ce8f11ddde571d1d",
    "environment": "production",
    "platforms": [],
    "lastUpdated": "2022-02-28T08:45:16.445Z",
    "creationTime": "2022-02-28T08:45:16.445Z",
    "dvrUnits": 0,
    "maxConcurrentUsers": 0
  }
}

recording-exported: The stream recording is exported to the cloud server. Meaning LiveAPI has converted the VOD file successfully, and you can get its media info.

{
  "event": "recording-exported",
  "payload": {
    "_id": "6226ce5f31ddbeb3754aa243",
    "mediainfo": {
      "duration": "299.980",
      "track": [
        {
          "@type": "General",
          "VideoCount": "3",
          "AudioCount": "1",
          "FileExtension": "mp4",
          "Format": "MPEG-4",
          "FileSize": "70392635",
          "Duration": "299.980",
          "OverallBitRate_Mode": "VBR",
          "OverallBitRate": "1877262",
          "FrameRate": "30.000"
        },
        {
          "@type": "Video",
          "Format": "AVC",
          "Format_Profile": "Main",
          "Format_Level": "3.1",
          "CodecID": "avc1",
          "BitRate": "926154",
          "Width": "1280",
          "Height": "720",
          "DisplayAspectRatio_String": "16:9",
          "FrameRate_Mode": "CFR",
          "FrameRate": "30.000"
        },
        {
          "@type": "Audio",
          "Format": "AAC",
          "CodecID": "mp4a-40-2",
          "Channels": "2",
          "ChannelPositions": "Front: L R",
          "SamplingRate": "48000"
        }
      ]
    }
  }
}

Multistream events

We currently support the following events for Multistream related actions:

stream-platform-added: Multistream target created.

{
  "event": "stream-platform-added",
  "payload": {
    "_id": "6226ce5f31ddbeb3754aa243",
    "platform": {
      "server": "rtmp://a.rtmp.youtube.com/live2",
      "key": "debs-4ux2-r565-1sv4-444",
      "enabled": true,
      "_id": "6226d15f31ddbeb3754aa27b"
    }
  }
}

stream-platform-connected: Multistream target connected and is broadcasting.

{
  "event": "stream-platform-connected",
  "payload": {
    "_id": "6226ce5f31ddbeb3754aa243",
    "platform": {
      "_id": "6226ce8431ddbeb3754aa249",
      "server": "rtmp://a.rtmp.youtube.com/live2",
      "key": "debs-4ux2-r565-1sv4-68zh",
      "enabled": true,
      "creationTime": "2022-03-08T03:33:25.053Z"
    }
  }
}

stream-platform-disconnected: Multistream target disconnected and stopped broadcasting.

{
  "event": "stream-platform-disconnected",
  "payload": {
    "_id": "6226ce5f31ddbeb3754aa243",
    "platform": {
      "_id": "6226ce8431ddbeb3754aa249",
      "server": "rtmp://a.rtmp.youtube.com/live2",
      "key": "debs-4ux2-r565-1sv4-68zh",
      "enabled": true,
      "creationTime": "2022-03-08T03:33:25.053Z"
    },
    "reason": {
      "reason": "stop_timeout",
      "while": "checking"
    }
  }
}

In case of an error in the server or key field (not correct or expired), the reason for disconnecting will be rtmp_closed or closed.

{
  "event": "stream-platform-disconnected",
  "payload": {
    "_id": "6226ce5f31ddbeb3754aa243",
    "platform": {
      "_id": "6226d15f31ddbeb3754aa27b",
      "server": "rtmp://a.rtmp.youtube.com/live2",
      "key": "debs-4ux2-r565-1sv4-444",
      "enabled": true,
      "creationTime": "2022-03-08T03:45:35.424Z"
    },
    "reason": {
      "reason": "rtmp_closed",
      "while": "connecting"
    }
  }
}
{
  "event": "stream-platform-disconnected",
  "payload": {
    "_id": "6226ce5f31ddbeb3754aa243",
    "platform": {
      "_id": "6226d204acc1bbb37d2d66a2",
      "server": "rtmp://a.rtmp.youtube.com/live100",
      "key": "debs-4ux2-r565-1sv4-68zh",
      "enabled": true,
      "creationTime": "2022-03-08T03:48:20.926Z"
    },
    "reason": {
      "reason": "closed",
      "while": "connecting"
    }
  }
}

stream-platform-removed: Multistream target deleted.

{
  "event": "stream-platform-removed",
  "payload": {
    "_id": "620e0d57427ff4ddd764515f",
    "platform": {
      "_id": "621f3d8ae0d97130801f6040",
      "server": "rtmp://abcd.com",
      "key": "pwd123",
      "enabled": false,
      "creationTime": "2022-03-02T09:48:58.498Z"
    }
  }
}