> For the complete documentation index, see [llms.txt](https://developers-apps-in-toss.toss.im/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-zh/sdk/domains-api/share/share.createlink.md).

# Share.createLink

> 函数式 API `getTossShareLink`也可以使用相同功能。函数式 API 是 `getTossShareLink(path, ogImageUrl)` 接收这种形式的位置参数。

### 功能说明

创建一个可在 Toss 应用中打开指定路径的分享链接。分享此链接时，会启动 Toss 应用并进入指定路径。没有 Toss 应用的人在 iOS 上会跳转到 App Store，在 Android 上会跳转到 Play 商店。

路径是 `intoss://`必须是以 \`intoss\://\` 开头的深度链接格式。例如 `intoss://my-app` 或 `intoss://my-app/about?name=test`这样写。

可选地，OG 图片 URL(`ogImageUrl`)也可以传入。 `ogImageUrl`仅在 Toss 应用 Android `5.240.0`, iOS `5.239.0` 及以上版本适用。低于该版本时，会在默认分享链接上 `包含 deep_link_value` 附加查询参数来生成链接。

### 类型

```ts
Share.createLink(params: { path: string; ogImageUrl?: string }): Promise<string>;
```

**Params**

```ts
{
  /** 这是希望用深度链接打开的路径。必须以 `intoss://` 开头。 */
  path: string;
  /** 用于分享链接预览的 OG 图片 URL。 */
  ogImageUrl?: string;
}
```

**Response**

返回可在 Toss 应用中打开的分享链接字符串。

### 示例代码

#### JavaScript

```js
import { Share } from "@apps-in-toss/web-framework";

try {
  const tossLink = await Share.createLink({ path: "intoss://my-app" });
  await Share.sendMessage({ message: tossLink });
} catch (error) {
  console.error(error);
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers-apps-in-toss.toss.im/documentation/api-and-sdk-zh/sdk/domains-api/share/share.createlink.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
