> 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/api/zh/push.md).

# 推送、通知

## 发送消息

> 此 API 允许合作伙伴应用向 Toss 用户发送通知或消息。需要用户认证令牌，并且必须包含可向用户发送消息的 scope 权限。包括测试发送在内，所有消息都只能在通过文案审核并获得批准后发送。\
> \
> \### 业务错误代码\
> \
> 以下错误会与 HTTP 200 和 \`resultType: FAIL\`一起返回。\
> \
> \| errorCode | 说明                             |\
> \| --------- | ------------------------------ |\
> \| \`5004\`    | 这是未获批准的消息模板。要发送消息，需要先通过模板审核批准。 |\
> \| \`4034\`    | 没有工作区，或者没有访问该工作区的权限            |\
> \| \`4010\`    | 找不到认证信息。                       |\
> \| \`4095\`    | 已超过请求上限。请稍后再试。                 |\
> \
> 此 API 可以原样传递已联动内部系统的错误代码。未文档化的 \`errorCode\`将被视为失败并 \`reason\` 请参考消息。\
> \
> \*\*请求上限\*\*: 每个应用每分钟 15,000 次，每个用户每分钟 10 次

```json
{"openapi":"3.1.0","info":{"title":"Apps in Toss 合作伙伴 API","version":"1.0.0"},"tags":[{"description":"这是在合作伙伴应用中处理 Toss 用户与消息时使用的 API。","name":"push"}],"servers":[{"description":"运营（简易登录·消息发送·Toss 积分发放等）","url":"https://apps-in-toss-api.toss.im"}],"security":[{"mutualTLS":[]}],"components":{"securitySchemes":{"mutualTLS":{"description":"这是基于发给合作伙伴的客户端证书的 mTLS 认证。通过证书的 CN 识别迷你应用。证书签发·管理方法请参考 [使用服务器 API](https://developers-apps-in-toss.toss.im/documentation/integration/server-api) 文档。","type":"mutualTLS"}},"schemas":{"SendMessageRequest":{"description":"定义要发送给用户的消息。包含将使用哪种消息模板以及模板中要填入的数据。","properties":{"context":{"additionalProperties":{"type":"object"},"description":"这是用于模板的变量值。例如，填入用户姓名或验证码等值。","type":"object"},"templateSetCode":{"description":"这是要使用的消息模板代码。填写预先注册的模板代码之一。","type":"string"}},"required":["context","templateSetCode"],"type":"object"},"TossApiSuccessSendMessageResponse":{"description":"这是成功响应封装。","properties":{"resultType":{"description":"这是处理结果。成功时 `SUCCESS`。","enum":["SUCCESS"],"type":"string"},"success":{"$ref":"#/components/schemas/SendMessageResponse"}},"required":["resultType","success"],"type":"object"},"SendMessageResponse":{"description":"其中包含按渠道发送了多少条消息，以及成功/失败消息的详细信息。","properties":{"detail":{"$ref":"#/components/schemas/AppendContextResultDetailResponse","description":"这是成功发送的消息详情。"},"fail":{"$ref":"#/components/schemas/AppendContextResultDetailResponse","description":"这是发送失败的消息详情。"},"msgCount":{"description":"这是总发送消息数。","format":"int32","type":"integer"},"sentAlimtalkCount":{"description":"这是通过通知消息发送的消息数。","format":"int32","type":"integer"},"sentFriendtalkCount":{"description":"这是通过好友消息发送的消息数。","format":"int32","type":"integer"},"sentInboxCount":{"description":"这是通过收件箱(Inbox)发送的消息数。","format":"int32","type":"integer"},"sentPushCount":{"description":"这是通过推送(Push)发送的消息数。","format":"int32","type":"integer"},"sentSmsCount":{"description":"这是通过 SMS 发送的消息数。","format":"int32","type":"integer"}},"required":["detail","fail","msgCount","sentAlimtalkCount","sentFriendtalkCount","sentInboxCount","sentPushCount","sentSmsCount"]},"AppendContextResultDetailResponse":{"description":"这是按各渠道发送的消息详情列表。可以知道哪条消息在哪个渠道成功或失败。","properties":{"sentAlimtalk":{"description":"这是通过通知消息发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentFriendtalk":{"description":"这是通过好友消息发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentInbox":{"description":"这是通过收件箱(Inbox)发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentPush":{"description":"这是通过推送(Push)发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentSms":{"description":"这是通过 SMS 发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"}},"required":["sentAlimtalk","sentFriendtalk","sentInbox","sentPush","sentSms"]},"SentContentResponse":{"description":"这是单条已发送消息的信息。","properties":{"contentId":{"description":"这是已发送消息的唯一 ID。","type":"string"},"reachedFailReason":{"description":"如果消息送达失败，这里会包含失败原因。","type":"string"}},"required":["contentId"]},"TossApiFail":{"description":"这是失败响应封装。业务错误会以 HTTP 200 返回，所以 `resultType`请务必确认。","properties":{"error":{"$ref":"#/components/schemas/TossApiError"},"resultType":{"description":"这是处理结果。 `SUCCESS`除 SUCCESS 之外的值都请视为失败处理。通常 `FAIL`。","enum":["FAIL","HTTP_TIMEOUT","NETWORK_ERROR","EXECUTION_FAIL","INTERRUPTED","INTERNAL_ERROR"],"type":"string"},"success":{"description":"失败时始终为 null。"}},"required":["error","resultType"],"type":"object"},"TossApiError":{"description":"这是错误详细信息。","properties":{"data":{"description":"这是错误附加信息。请求限额超出时 `retryAfterSeconds`会包含其中。","type":"object"},"errorCode":{"description":"这是错误代码。请参考各 API 的业务错误代码表。","type":"string"},"errorType":{"description":"这是内部错误分类值。错误区分时 `errorCode`请用于错误区分。","format":"int32","type":"integer"},"reason":{"description":"这是人类可读的错误说明。","type":"string"},"title":{"description":"这是错误标题。大多为 null。","type":"string"}},"required":["errorCode","reason"],"type":"object"},"TossApiValidationFail":{"description":"这是请求字段验证失败时的响应。","properties":{"error":{"$ref":"#/components/schemas/TossApiValidationFailError"},"resultType":{"description":"这是处理结果。 `SUCCESS`除 SUCCESS 之外的值都请视为失败处理。通常 `FAIL`。","enum":["FAIL","HTTP_TIMEOUT","NETWORK_ERROR","EXECUTION_FAIL","INTERRUPTED","INTERNAL_ERROR"],"type":"string"},"success":{"description":"失败时始终为 null。"}},"required":["error","resultType"],"type":"object"},"TossApiValidationFailError":{"description":"这是错误详细信息。","properties":{"data":{"description":"这是错误附加信息。请求限额超出时 `retryAfterSeconds`会包含其中。","properties":{"errorDetails":{"description":"这是按字段划分的验证失败详情列表。","items":{"$ref":"#/components/schemas/TossApiFieldError"},"type":"array"}},"type":"object"},"errorCode":{"description":"这是错误代码。请参考各 API 的业务错误代码表。","type":"string"},"errorType":{"description":"这是内部错误分类值。错误区分时 `errorCode`请用于错误区分。","format":"int32","type":"integer"},"reason":{"description":"这是人类可读的错误说明。","type":"string"},"title":{"description":"这是错误标题。大多为 null。","type":"string"}},"required":["errorCode","reason"],"type":"object"},"TossApiFieldError":{"description":"这是按字段划分的验证失败详情列表。","properties":{"field":{"description":"这是验证失败的字段名。","type":"string"},"message":{"description":"这是验证失败原因。","type":"string"},"rejectedValue":{"description":"这是被拒绝的输入值。"}},"type":"object"}}},"paths":{"/api-partner/v1/apps-in-toss/messenger/send-message":{"post":{"description":"此 API 允许合作伙伴应用向 Toss 用户发送通知或消息。需要用户认证令牌，并且必须包含可向用户发送消息的 scope 权限。包括测试发送在内，所有消息都只能在通过文案审核并获得批准后发送。\n\n### 业务错误代码\n\n以下错误会与 HTTP 200 和 `resultType: FAIL`一起返回。\n\n| errorCode | 说明                             |\n| --------- | ------------------------------ |\n| `5004`    | 这是未获批准的消息模板。要发送消息，需要先通过模板审核批准。 |\n| `4034`    | 没有工作区，或者没有访问该工作区的权限            |\n| `4010`    | 找不到认证信息。                       |\n| `4095`    | 已超过请求上限。请稍后再试。                 |\n\n此 API 可以原样传递已联动内部系统的错误代码。未文档化的 `errorCode`将被视为失败并 `reason` 请参考消息。\n\n**请求上限**: 每个应用每分钟 15,000 次，每个用户每分钟 10 次","operationId":"sendMessage","parameters":[{"description":"这是用于认证用户的密钥。 [获取用户信息](https://developers-apps-in-toss.toss.im/documentation/api/toss-login#get-api-partner-v1-apps-in-toss-user-oauth2-login-me) 可以通过 API 获取","in":"header","name":"x-toss-user-key","required":false,"schema":{"type":"string"}},{"description":"这是用于认证用户的密钥。Mini App SDK 的 [User.getAnonymousKey](https://developers-apps-in-toss.toss.im/documentation/sdk/domains-api/user/user.getanonymouskey) 函数获取","in":"header","name":"x-anon-key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageRequest"}}},"description":"这是要发送的消息信息。","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"discriminator":{"mapping":{"FAIL":"#/components/schemas/TossApiFail","SUCCESS":"#/components/schemas/TossApiSuccessSendMessageResponse"},"propertyName":"resultType"},"oneOf":[{"$ref":"#/components/schemas/TossApiSuccessSendMessageResponse"},{"$ref":"#/components/schemas/TossApiFail"}]}}},"description":"消息发送成功"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TossApiValidationFail"}}},"description":"请求正文格式不正确。 `error.data.errorDetails`请在此查看各字段详情。"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TossApiFail"}}},"description":"分类未明的服务器错误。若持续失败，请联系合作伙伴支持渠道。"}},"summary":"发送消息","tags":["push"]}}}}
```

## 发送批量消息

> 向多个用户按相同模板批量发送消息。请在至少 50 条以上的大量发送时使用。一次请求最多可发送 2,500 条。\
> \
> \### 业务错误代码\
> \
> 以下错误会与 HTTP 200 和 \`resultType: FAIL\`一起返回。\
> \
> \| errorCode | 说明                             |\
> \| --------- | ------------------------------ |\
> \| \`5004\`    | 这是未获批准的消息模板。要发送消息，需要先通过模板审核批准。 |\
> \| \`4034\`    | 没有工作区，或者没有访问该工作区的权限            |\
> \| \`4095\`    | 已超过请求上限。请稍后再试。                 |\
> \
> 此 API 可以原样传递已联动内部系统的错误代码。未文档化的 \`errorCode\`将被视为失败并 \`reason\` 请参考消息。\
> \
> \*\*请求上限\*\*: 每个应用每分钟 3,000 次

```json
{"openapi":"3.1.0","info":{"title":"Apps in Toss 合作伙伴 API","version":"1.0.0"},"tags":[{"description":"这是在合作伙伴应用中处理 Toss 用户与消息时使用的 API。","name":"push"}],"servers":[{"description":"运营（简易登录·消息发送·Toss 积分发放等）","url":"https://apps-in-toss-api.toss.im"}],"security":[{"mutualTLS":[]}],"components":{"securitySchemes":{"mutualTLS":{"description":"这是基于发给合作伙伴的客户端证书的 mTLS 认证。通过证书的 CN 识别迷你应用。证书签发·管理方法请参考 [使用服务器 API](https://developers-apps-in-toss.toss.im/documentation/integration/server-api) 文档。","type":"mutualTLS"}},"schemas":{"BulkSendMessageRequest":{"description":"用于定义批量发送给用户的消息。会同时包含要使用的消息模板以及模板中要使用的数据列表。","properties":{"contextList":{"description":"这是接收消息的用户的 userKey 或 anonKey 以及变量值列表。","items":{"$ref":"#/components/schemas/BulkSendMessageContext"},"type":"array"},"templateSetCode":{"description":"这是要使用的消息模板代码。填写预先注册的模板代码之一。","type":"string"}},"required":["contextList","templateSetCode"]},"BulkSendMessageContext":{"description":"这是在批量发送消息时，包含单个收件人信息和模板变量值的条目。","properties":{"anonKey":{"description":"这是在应用中发放的匿名用户标识符。","type":"string"},"context":{"additionalProperties":{"type":"object"},"description":"这是用于模板的变量值。例如，填入用户姓名或验证码等值。","type":"object"},"userKey":{"description":"这是用户的唯一标识符。","format":"int64","type":"integer"}},"required":["context"]},"TossApiSuccessBulkSendMessageResponse":{"description":"这是成功响应封装。","properties":{"resultType":{"description":"这是处理结果。成功时 `SUCCESS`。","enum":["SUCCESS"],"type":"string"},"success":{"$ref":"#/components/schemas/BulkSendMessageResponse"}},"required":["resultType","success"],"type":"object"},"BulkSendMessageResponse":{"description":"其中包含按渠道发送了多少条消息，以及成功/失败消息的详细信息。","properties":{"detail":{"$ref":"#/components/schemas/AppendContextResultDetailResponse","description":"这是成功发送的消息详情。"},"fail":{"$ref":"#/components/schemas/AppendContextResultDetailResponse","description":"这是发送失败的消息详情。"},"msgCount":{"description":"这是总发送消息数。","format":"int32","type":"integer"},"sentAlimtalkCount":{"description":"这是通过通知消息发送的消息数。","format":"int32","type":"integer"},"sentFriendtalkCount":{"description":"这是通过好友消息发送的消息数。","format":"int32","type":"integer"},"sentInboxCount":{"description":"这是通过收件箱(Inbox)发送的消息数。","format":"int32","type":"integer"},"sentPushCount":{"description":"这是通过推送(Push)发送的消息数。","format":"int32","type":"integer"},"sentSmsCount":{"description":"这是通过 SMS 发送的消息数。","format":"int32","type":"integer"}},"required":["detail","fail","msgCount","sentAlimtalkCount","sentFriendtalkCount","sentInboxCount","sentPushCount","sentSmsCount"]},"AppendContextResultDetailResponse":{"description":"这是按各渠道发送的消息详情列表。可以知道哪条消息在哪个渠道成功或失败。","properties":{"sentAlimtalk":{"description":"这是通过通知消息发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentFriendtalk":{"description":"这是通过好友消息发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentInbox":{"description":"这是通过收件箱(Inbox)发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentPush":{"description":"这是通过推送(Push)发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentSms":{"description":"这是通过 SMS 发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"}},"required":["sentAlimtalk","sentFriendtalk","sentInbox","sentPush","sentSms"]},"SentContentResponse":{"description":"这是单条已发送消息的信息。","properties":{"contentId":{"description":"这是已发送消息的唯一 ID。","type":"string"},"reachedFailReason":{"description":"如果消息送达失败，这里会包含失败原因。","type":"string"}},"required":["contentId"]},"TossApiFail":{"description":"这是失败响应封装。业务错误会以 HTTP 200 返回，所以 `resultType`请务必确认。","properties":{"error":{"$ref":"#/components/schemas/TossApiError"},"resultType":{"description":"这是处理结果。 `SUCCESS`除 SUCCESS 之外的值都请视为失败处理。通常 `FAIL`。","enum":["FAIL","HTTP_TIMEOUT","NETWORK_ERROR","EXECUTION_FAIL","INTERRUPTED","INTERNAL_ERROR"],"type":"string"},"success":{"description":"失败时始终为 null。"}},"required":["error","resultType"],"type":"object"},"TossApiError":{"description":"这是错误详细信息。","properties":{"data":{"description":"这是错误附加信息。请求限额超出时 `retryAfterSeconds`会包含其中。","type":"object"},"errorCode":{"description":"这是错误代码。请参考各 API 的业务错误代码表。","type":"string"},"errorType":{"description":"这是内部错误分类值。错误区分时 `errorCode`请用于错误区分。","format":"int32","type":"integer"},"reason":{"description":"这是人类可读的错误说明。","type":"string"},"title":{"description":"这是错误标题。大多为 null。","type":"string"}},"required":["errorCode","reason"],"type":"object"},"TossApiValidationFail":{"description":"这是请求字段验证失败时的响应。","properties":{"error":{"$ref":"#/components/schemas/TossApiValidationFailError"},"resultType":{"description":"这是处理结果。 `SUCCESS`除 SUCCESS 之外的值都请视为失败处理。通常 `FAIL`。","enum":["FAIL","HTTP_TIMEOUT","NETWORK_ERROR","EXECUTION_FAIL","INTERRUPTED","INTERNAL_ERROR"],"type":"string"},"success":{"description":"失败时始终为 null。"}},"required":["error","resultType"],"type":"object"},"TossApiValidationFailError":{"description":"这是错误详细信息。","properties":{"data":{"description":"这是错误附加信息。请求限额超出时 `retryAfterSeconds`会包含其中。","properties":{"errorDetails":{"description":"这是按字段划分的验证失败详情列表。","items":{"$ref":"#/components/schemas/TossApiFieldError"},"type":"array"}},"type":"object"},"errorCode":{"description":"这是错误代码。请参考各 API 的业务错误代码表。","type":"string"},"errorType":{"description":"这是内部错误分类值。错误区分时 `errorCode`请用于错误区分。","format":"int32","type":"integer"},"reason":{"description":"这是人类可读的错误说明。","type":"string"},"title":{"description":"这是错误标题。大多为 null。","type":"string"}},"required":["errorCode","reason"],"type":"object"},"TossApiFieldError":{"description":"这是按字段划分的验证失败详情列表。","properties":{"field":{"description":"这是验证失败的字段名。","type":"string"},"message":{"description":"这是验证失败原因。","type":"string"},"rejectedValue":{"description":"这是被拒绝的输入值。"}},"type":"object"}}},"paths":{"/api-partner/v1/apps-in-toss/messenger/send-bulk-message":{"post":{"description":"向多个用户按相同模板批量发送消息。请在至少 50 条以上的大量发送时使用。一次请求最多可发送 2,500 条。\n\n### 业务错误代码\n\n以下错误会与 HTTP 200 和 `resultType: FAIL`一起返回。\n\n| errorCode | 说明                             |\n| --------- | ------------------------------ |\n| `5004`    | 这是未获批准的消息模板。要发送消息，需要先通过模板审核批准。 |\n| `4034`    | 没有工作区，或者没有访问该工作区的权限            |\n| `4095`    | 已超过请求上限。请稍后再试。                 |\n\n此 API 可以原样传递已联动内部系统的错误代码。未文档化的 `errorCode`将被视为失败并 `reason` 请参考消息。\n\n**请求上限**: 每个应用每分钟 3,000 次","operationId":"sendBulkMessage","parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkSendMessageRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"discriminator":{"mapping":{"FAIL":"#/components/schemas/TossApiFail","SUCCESS":"#/components/schemas/TossApiSuccessBulkSendMessageResponse"},"propertyName":"resultType"},"oneOf":[{"$ref":"#/components/schemas/TossApiSuccessBulkSendMessageResponse"},{"$ref":"#/components/schemas/TossApiFail"}]}}},"description":"这是请求处理结果。 `resultType` 请通过值区分成功/失败。"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TossApiValidationFail"}}},"description":"请求正文格式不正确。 `error.data.errorDetails`请在此查看各字段详情。"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TossApiFail"}}},"description":"分类未明的服务器错误。若持续失败，请联系合作伙伴支持渠道。"}},"summary":"发送批量消息","tags":["push"]}}}}
```

## 发送测试消息

> 此 API 允许合作伙伴应用接收消息，并确认审核前的 bundle 是否正常工作。需要用户认证令牌，并且必须包含可向用户发送消息的 scope 权限。包括测试发送在内，所有消息都只能在通过文案审核并获得批准后发送。\
> \
> \### 业务错误代码\
> \
> 以下错误会与 HTTP 200 和 \`resultType: FAIL\`一起返回。\
> \
> \| errorCode | 说明             |\
> \| --------- | -------------- |\
> \| \`4010\`    | 找不到认证信息。       |\
> \| \`4095\`    | 已超过请求上限。请稍后再试。 |\
> \
> 此 API 可以原样传递已联动内部系统的错误代码。未文档化的 \`errorCode\`将被视为失败并 \`reason\` 请参考消息。\
> \
> \*\*请求上限\*\*: 每个应用每分钟 3,000 次

```json
{"openapi":"3.1.0","info":{"title":"Apps in Toss 合作伙伴 API","version":"1.0.0"},"tags":[{"description":"这是在合作伙伴应用中处理 Toss 用户与消息时使用的 API。","name":"push"}],"servers":[{"description":"运营（简易登录·消息发送·Toss 积分发放等）","url":"https://apps-in-toss-api.toss.im"}],"security":[{"mutualTLS":[]}],"components":{"securitySchemes":{"mutualTLS":{"description":"这是基于发给合作伙伴的客户端证书的 mTLS 认证。通过证书的 CN 识别迷你应用。证书签发·管理方法请参考 [使用服务器 API](https://developers-apps-in-toss.toss.im/documentation/integration/server-api) 文档。","type":"mutualTLS"}},"schemas":{"TestSendMessageRequest":{"description":"定义要发送给用户的消息。包含将使用哪种消息模板以及模板中要填入的数据。","properties":{"context":{"additionalProperties":{"type":"object"},"description":"这是用于模板的变量值。例如，填入用户姓名或验证码等值。","type":"object"},"deploymentId":{"description":"这是消息发送测试时使用的 bundle 标识值。可在 UUID 形式的、上传到 Apps in Toss 控制台应用发布菜单中的 bundle 中确认。","type":"string"},"templateSetCode":{"description":"这是要使用的消息模板代码。填写预先注册的模板代码之一。","type":"string"}},"required":["context","deploymentId","templateSetCode"],"type":"object"},"TossApiSuccessTestSendMessageResponse":{"description":"这是成功响应封装。","properties":{"resultType":{"description":"这是处理结果。成功时 `SUCCESS`。","enum":["SUCCESS"],"type":"string"},"success":{"$ref":"#/components/schemas/TestSendMessageResponse"}},"required":["resultType","success"],"type":"object"},"TestSendMessageResponse":{"description":"其中包含按渠道发送了多少条消息，以及成功/失败消息的详细信息。","properties":{"detail":{"$ref":"#/components/schemas/AppendContextResultDetailResponse","description":"这是成功发送的消息详情。"},"fail":{"$ref":"#/components/schemas/AppendContextResultDetailResponse","description":"这是发送失败的消息详情。"},"msgCount":{"description":"这是总发送消息数。","format":"int32","type":"integer"},"sentAlimtalkCount":{"description":"这是通过通知消息发送的消息数。","format":"int32","type":"integer"},"sentFriendtalkCount":{"description":"这是通过好友消息发送的消息数。","format":"int32","type":"integer"},"sentInboxCount":{"description":"这是通过收件箱(Inbox)发送的消息数。","format":"int32","type":"integer"},"sentPushCount":{"description":"这是通过推送(Push)发送的消息数。","format":"int32","type":"integer"},"sentSmsCount":{"description":"这是通过 SMS 发送的消息数。","format":"int32","type":"integer"}},"required":["detail","fail","msgCount","sentAlimtalkCount","sentFriendtalkCount","sentInboxCount","sentPushCount","sentSmsCount"]},"AppendContextResultDetailResponse":{"description":"这是按各渠道发送的消息详情列表。可以知道哪条消息在哪个渠道成功或失败。","properties":{"sentAlimtalk":{"description":"这是通过通知消息发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentFriendtalk":{"description":"这是通过好友消息发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentInbox":{"description":"这是通过收件箱(Inbox)发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentPush":{"description":"这是通过推送(Push)发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"},"sentSms":{"description":"这是通过 SMS 发送的消息列表。","items":{"$ref":"#/components/schemas/SentContentResponse"},"type":"array"}},"required":["sentAlimtalk","sentFriendtalk","sentInbox","sentPush","sentSms"]},"SentContentResponse":{"description":"这是单条已发送消息的信息。","properties":{"contentId":{"description":"这是已发送消息的唯一 ID。","type":"string"},"reachedFailReason":{"description":"如果消息送达失败，这里会包含失败原因。","type":"string"}},"required":["contentId"]},"TossApiFail":{"description":"这是失败响应封装。业务错误会以 HTTP 200 返回，所以 `resultType`请务必确认。","properties":{"error":{"$ref":"#/components/schemas/TossApiError"},"resultType":{"description":"这是处理结果。 `SUCCESS`除 SUCCESS 之外的值都请视为失败处理。通常 `FAIL`。","enum":["FAIL","HTTP_TIMEOUT","NETWORK_ERROR","EXECUTION_FAIL","INTERRUPTED","INTERNAL_ERROR"],"type":"string"},"success":{"description":"失败时始终为 null。"}},"required":["error","resultType"],"type":"object"},"TossApiError":{"description":"这是错误详细信息。","properties":{"data":{"description":"这是错误附加信息。请求限额超出时 `retryAfterSeconds`会包含其中。","type":"object"},"errorCode":{"description":"这是错误代码。请参考各 API 的业务错误代码表。","type":"string"},"errorType":{"description":"这是内部错误分类值。错误区分时 `errorCode`请用于错误区分。","format":"int32","type":"integer"},"reason":{"description":"这是人类可读的错误说明。","type":"string"},"title":{"description":"这是错误标题。大多为 null。","type":"string"}},"required":["errorCode","reason"],"type":"object"},"TossApiValidationFail":{"description":"这是请求字段验证失败时的响应。","properties":{"error":{"$ref":"#/components/schemas/TossApiValidationFailError"},"resultType":{"description":"这是处理结果。 `SUCCESS`除 SUCCESS 之外的值都请视为失败处理。通常 `FAIL`。","enum":["FAIL","HTTP_TIMEOUT","NETWORK_ERROR","EXECUTION_FAIL","INTERRUPTED","INTERNAL_ERROR"],"type":"string"},"success":{"description":"失败时始终为 null。"}},"required":["error","resultType"],"type":"object"},"TossApiValidationFailError":{"description":"这是错误详细信息。","properties":{"data":{"description":"这是错误附加信息。请求限额超出时 `retryAfterSeconds`会包含其中。","properties":{"errorDetails":{"description":"这是按字段划分的验证失败详情列表。","items":{"$ref":"#/components/schemas/TossApiFieldError"},"type":"array"}},"type":"object"},"errorCode":{"description":"这是错误代码。请参考各 API 的业务错误代码表。","type":"string"},"errorType":{"description":"这是内部错误分类值。错误区分时 `errorCode`请用于错误区分。","format":"int32","type":"integer"},"reason":{"description":"这是人类可读的错误说明。","type":"string"},"title":{"description":"这是错误标题。大多为 null。","type":"string"}},"required":["errorCode","reason"],"type":"object"},"TossApiFieldError":{"description":"这是按字段划分的验证失败详情列表。","properties":{"field":{"description":"这是验证失败的字段名。","type":"string"},"message":{"description":"这是验证失败原因。","type":"string"},"rejectedValue":{"description":"这是被拒绝的输入值。"}},"type":"object"}}},"paths":{"/api-partner/v1/apps-in-toss/messenger/send-test-message":{"post":{"description":"此 API 允许合作伙伴应用接收消息，并确认审核前的 bundle 是否正常工作。需要用户认证令牌，并且必须包含可向用户发送消息的 scope 权限。包括测试发送在内，所有消息都只能在通过文案审核并获得批准后发送。\n\n### 业务错误代码\n\n以下错误会与 HTTP 200 和 `resultType: FAIL`一起返回。\n\n| errorCode | 说明             |\n| --------- | -------------- |\n| `4010`    | 找不到认证信息。       |\n| `4095`    | 已超过请求上限。请稍后再试。 |\n\n此 API 可以原样传递已联动内部系统的错误代码。未文档化的 `errorCode`将被视为失败并 `reason` 请参考消息。\n\n**请求上限**: 每个应用每分钟 3,000 次","operationId":"sendTestMessage","parameters":[{"description":"这是用于认证用户的密钥。 [获取用户信息](https://developers-apps-in-toss.toss.im/documentation/api/toss-login#get-api-partner-v1-apps-in-toss-user-oauth2-login-me) 可以通过 API 获取","in":"header","name":"x-toss-user-key","required":false,"schema":{"type":"string"}},{"description":"这是用于认证用户的密钥。Mini App SDK 的 [User.getAnonymousKey](https://developers-apps-in-toss.toss.im/documentation/sdk/domains-api/user/user.getanonymouskey) 函数获取","in":"header","name":"x-anon-key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestSendMessageRequest"}}},"description":"这是要发送的消息信息。","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"discriminator":{"mapping":{"FAIL":"#/components/schemas/TossApiFail","SUCCESS":"#/components/schemas/TossApiSuccessTestSendMessageResponse"},"propertyName":"resultType"},"oneOf":[{"$ref":"#/components/schemas/TossApiSuccessTestSendMessageResponse"},{"$ref":"#/components/schemas/TossApiFail"}]}}},"description":"消息发送成功"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TossApiValidationFail"}}},"description":"请求正文格式不正确。 `error.data.errorDetails`请在此查看各字段详情。"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TossApiFail"}}},"description":"分类未明的服务器错误。若持续失败，请联系合作伙伴支持渠道。"}},"summary":"发送测试消息","tags":["push"]}}}}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers-apps-in-toss.toss.im/api/zh/push.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
