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 |
|
| The share title | No |
|
| The share description | No |
|
| The share image URL | No |
|
| The custom share query string | No |
|
| The callback called when the API call succeeds | No |
|
| The callback called when the API call fails | No |
|
| 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 |
|
| 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 |
|
| 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 |
|
| The query string. When a user enters the mini game from this share message, the query can be retrieved from the launch parameters via | No |
|
| The subtitle. Customization from the API is not supported at this time; the value is taken from what is configured on the platform. | No |
|
| The callback called when the API call succeeds | No |
|
| The callback called when the API call fails | No |
|
| 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 |
|
| 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 |
|
| The share title |
|
| The share description |
|
| The share image URL |
|
| 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()