TikTok for Developers

Developer Docs

Last updated October 1, 2026

Sharing

Allow users to share content to stories, send direct messages to contacts, or customize the metadata attached to copied links.

TTMinis.game.shareToStory(opts)

Shares content to a story.

Parameters

Field

Type

Description

Required

title

string

The share title

No

desc

string

The share description

No

imageUrl

string

The share image URL

No

query

string

The custom share query string

No

success

function

The callback called when the API call succeeds

No

fail

function

The callback called when the API call fails

No

complete

function

The callback called when the API call completes, regardless of success or failure

No

Example

TTMinis.game.shareToStory({
  title: 'SHARE_TITLE',
  desc: 'SHARE_DESC',
  imageUrl: 'IMAGE_URL',
  query: 'a=1&b=2',
  success(res) {
    console.log('share success', res)
  },
  fail(err) {
    console.log('share fail', err)
  }
})

TTMinis.game.shareAppMessage(opts)

Triggers the share flow and opens the contact picker.

Parameters

Field

Type

Description

Required

title

string

The share title. Customization from the API is not supported at this time; the value is taken from what is configured on the platform.

No

imageUrl

string

The URL of the image displayed in the share card. Customization from the API is not supported at this time; the value is taken from what is configured on the platform.

No

query

string

The query string. When a user enters the mini game from this share message, the query can be retrieved from the launch parameters via TTMinis.game.getLaunchOptionsSync() or TTMinis.game.onShow().

No

subTitle

string

The subtitle. Customization from the API is not supported at this time; the value is taken from what is configured on the platform.

No

success

function

The callback called when the API call succeeds

No

fail

function

The callback called when the API call fails

No

complete

function

The callback called when the API call completes, regardless of success or failure

No

Example

TTMinis.game.shareAppMessage({
  query: 'a=1&b=2',
  success(res) {
    console.log('share success', res)
  },
  fail(err) {
    console.log('share fail', err)
  }
})

TTMinis.game.onCopyUrl(listener)

Listens for the event triggered when the user taps the "Copy link" button in the top-right menu.

Parameters

Field

Type

Description

Required

listener

function

The listener function called when the user taps the "Copy link" button in the top-right menu. The function receives a response object described below.

Yes

The listener function receives an object with the following fields:

Field

Type

Description

title

string

The share title

desc

string

The share description

imageUrl

string

The share image URL

query

string

The custom share query string

The listener may also include the following callback fields: success, fail, and complete.

Example

// Bind share parameters
TTMinis.game.onCopyUrl(() => {
  return { query: 'a=1&b=2' }
})

// Unbind share parameters
TTMinis.game.offCopyUrl()

TTMinis.game.offCopyUrl()

Removes all listener functions for the event triggered when the user taps the "Copy link" button in the top-right menu.

Example

// Bind share parameters
TTMinis.game.onCopyUrl(() => {
  return { query: 'a=1&b=2' }
})

// Unbind share parameters
TTMinis.game.offCopyUrl()
TikTok for Developers