TikTok for Developers

Docs

Share

share(cb,opts)

TTMinis.share() needs to be used in conjunction with TTMinis.on('minis.share', callback). TikTok Minis link is generated by listening to the minis.share message (triggered by the user on the client) and executing TTMinis.share() in the message processing callback.

Callback

interface CallbackResult {
  is_success: boolean;
  error?: MinisError;
}

type Callback = (result: CallbackResult) => void;

Options

interface Options {
  title: string;
  desc?: string;
  imageUrl?: string;
  query?: Record<string, unknown>;
}

Example

TTMinis.on('minis.share', () => {
  TTMinis.share(()=>{
    //
  }, {
    title: "title of the current page",
    desc: "description of the current page",
    imageUrl: "image link of the current page",
    query: "query parameters of the current page route"
  })
})

.reportEvent(opts)

Report business events.

Parameter

Parameter

Type

Description

Required

eventName

string

Event Name

Yes

params

Record<string, any>

Event Parameters

Yes

callback

(result) => void

Report completion callback

No

Callback

Field

Type

Description

isSuccess

boolean

Whether it is successful

error

object

Return when failure

Example

TTMinis.reportEvent({
  eventName: 'drama_episode_play',
  params: {
    episodeId: 'ep_1001',
    position: 1,
  },  callback:


Was this document helpful?
TikTok for Developers