Skip to content

Get live by id

THis function recieve only the live id in int format and returns a promisse with live object. The code blow shows how to use it:

import { Metalives } from "metalives-sdk"
import dotenv from 'dotenv'

dotenv.config();

const client = new Metalives(process.env.SDK_TOKEN);

const live = await client.live.getLiveById(liveId);
// If you want to get live by alias, run:
// const live = await client.live.getLiveByAlias(liveAlias); 

And it will return a simple object in following format with its list of products.

{
  id: 'id of live',
  startsAt: 'start time of live',
  streamKey: 'stream key used to stream the live by rtmp server',
  uriAlias: 'Live alias used in url',
  streamUrl: 'Link to rtmp video stream',
  recordingUrl: 'Link to recorded video',
  visibility: 'Visibility of live',
  chatEnabled: 'True if chat is enabeled in live, false otherwise',
  status: 'Status of live',
  title: 'Live title',
  description: 'Live description',
  thumbImg: 'Thumb image of live',
  coverImgUrl: 'Cover image of live',
  createdAt: 'Timestamp of live creation',
  updatedAt: 'Timestamp of live update',
  organizationId: 'Organization Id that this live belongs',
  products: [
    {
      id: 'Product id',
      name: 'Product name',
      url: 'Link to product in original site',
      price: 'Real price of the product',
      originalPrice: 'Original price of the product',
      imageUrl: 'Link to product image',
      ref: 'Product reference in Marketplace',
      createdAt: 'Timestamp when was created',
      updatedAt: 'Timestamp when was updated last time',
      storeId: 'id of product in store'
    }
  ]
}