快工助手跨境电商知识与商机助手

Overview

TikTok Shop 官方资料 · TikTok Shop Partner Center 开发者文档 · 适合开发者

stable本次发布有变化全部展示

来自 TikTok Shop 官方资料快照 ·

打开官方原文 ↗
  1. 当前资料结构化阅读页
  2. 固定快照已留存,可追溯
  3. 官方原文可核对
查看技术与溯源信息
平台 / profile
TikTok Shop / profile.tiktok.docs_api
语言
en-US
发布版本
cn-20260909-2
标签
zhuge/sourceplatform/tiktok_shopaudience/developercategory/api_doctopic/compliancetopic/developer

资料正文

§1 Overview

Webhooks enable real-time HTTPS notifications for TikTok Shop events. After a shop subscribes to a webhook topic, TikTok Shop sends an HTTP POST request to the callback URL registered by the app when the subscribed event occurs. Do not rely on webhooks as the only source of truth. Network failures, endpoint downtime, retries, or delayed delivery can happen, so your system should also reconcile critical business state through scheduled API polling.

#

§2 How webhook delivery works

The diagram below shows the order-status webhook flow. The same delivery pattern applies to other webhook topics. Image

  1. The app subscribes to a webhook topic, such as ORDER_STATUS_CHANGE, for a shop.
  2. The app registers an HTTPS endpoint hosted by the app server.
  3. A matching business event happens in the shop, such as a new order or an order-status update.
  4. TikTok Shop publishes the event to the subscribed webhook topic.
  5. TikTok Shop sends a webhook request with the topic-specific payload to the registered endpoint.
#

§3 Webhook topic quick reference

Use the event_type value when configuring a shop webhook with the webhook API or in Partner Center. The delivered payload also contains a numeric type field. The shared Event API schema publishes the full event_type enum, but it does not publish a complete numeric type mapping for every topic. Do not branch only on the numeric type; use the subscribed event_type context and the topic-specific payload schema.

Webhook topicevent_type valuePayload type valueTrigger scenario
Order status changeORDER_STATUS_CHANGE1 in the sample payload; confirm against the topic page for production logicAn order is created or the order status changes.
Recipient address updateRECIPIENT_ADDRESS_UPDATESee topic-specific payload referenceThe recipient address of an order is updated.
Package updatePACKAGE_UPDATESee topic-specific payload referenceA package is updated, such as being combined, split, or changed because of address updates.
Product status changePRODUCT_STATUS_CHANGESee topic-specific payload referenceProduct audit results are updated.
Seller deauthorizationSELLER_DEAUTHORIZATIONSee topic-specific payload referenceA seller revokes or loses authorization for the app. Use this event to stop API calls for the shop and clean up local connection state.
Upcoming authorization expirationUPCOMING_AUTHORIZATION_EXPIRATIONSee topic-specific payload referenceThe seller authorization will expire soon. TikTok Shop sends this event 30 days before expiration and then daily at 00:00 until reauthorization is completed.
Cancellation status changeCANCELLATION_STATUS_CHANGESee topic-specific payload referenceAn order cancellation status changes.
Return status changeRETURN_STATUS_CHANGESee topic-specific payload referenceAn order return status changes.
New conversationNEW_CONVERSATIONSee topic-specific payload referenceA customer-service agent joins or leaves a conversation.
New messageNEW_MESSAGESee topic-specific payload referenceA new message is sent in a customer-service conversation.
Product information changePRODUCT_INFORMATION_CHANGESee topic-specific payload referenceChanges to a product title, description, main images, or attributes go live.
Product creationPRODUCT_CREATIONSee topic-specific payload referenceA new product is created.
Product category changePRODUCT_CATEGORY_CHANGESee topic-specific payload referenceA product category is changed.
New message listenerNEW_MESSAGE_LISTENERSee topic-specific payload referenceA creator sends a message to the seller.
Invoice status changeINVOICE_STATUS_CHANGESee topic-specific payload referenceThe status of an invoice upload changes after using the Upload Invoice endpoint.
Product audit status changePRODUCT_AUDIT_STATUS_CHANGESee topic-specific payload referenceThe product audit status changes.
Reverse status updateREVERSE_STATUS_UPDATESee topic-specific payload referenceA buyer raises a cancellation, refund-only, or return-and-refund request that requires seller action.

For shop connection lifecycle handling, subscribe to both UPCOMING_AUTHORIZATION_EXPIRATION and SELLER_DEAUTHORIZATION when your app needs to maintain long-lived shop access.

#

§4 Configure webhooks

You can configure a shop webhook in Partner Center or through the Event API. In Partner Center, open the app or service and go to the webhook or event-subscription settings:

Partner Center
  -> App & Service
  -> Select the app or service
  -> Webhooks / Event subscriptions
  -> Add or update the topic and callback URL

Console labels may vary by Partner Center version. The required configuration is the webhook topic, represented by event_type, and an HTTPS callback URL controlled by your app. To configure a webhook by API, call Update Shop Webhook:

PUT https://open-api.tiktokglobalshop.com/event/202309/webhooks?app_key={app_key}&timestamp={timestamp}&sign={sign}&shop_cipher={shop_cipher}
Content-Type: application/json
x-tts-access-token: {access_token}

{
  "address": "https://example.com/tiktok-shop/webhooks",
  "event_type": "ORDER_STATUS_CHANGE"
}

Use Get Shop Webhooks to inspect the currently configured webhook topics and callback URLs for a shop. Use Delete Shop Webhook only when you intentionally want to remove a topic subscription.

#

§5 Header and signature verification

TikTok Shop sends the webhook signature in the HTTP Authorization header. The value is the lowercase hexadecimal HMAC-SHA256 digest. It is not a bearer token and should not include a Bearer prefix. The signature is calculated as follows:

signature_base_string = app_key + raw_request_body
signature = HMAC-SHA256(signature_base_string, app_secret)

Important validation rules:

RuleWhy it matters
Use the raw request body exactly as received.Re-serializing JSON, sorting keys, changing whitespace, or changing encoding will produce a different signature.
Calculate the signature before parsing or modifying the body.Some web frameworks consume or normalize the body during JSON parsing. Store the raw body for verification.
Compare signatures using a constant-time comparison.This avoids timing-based comparison leaks.
Reject missing or mismatched signatures.The request should not be processed when the Authorization header is absent or invalid.

Reproducible example:

  1. App key:
abcdef
  1. Raw request body:
{"type":1,"tts_notification_id":"7380066284010030890","shop_id":"7495540735365777507","timestamp":1718305585,"data":{"is_on_hold_order":true,"order_id":"576653688135258178","order_status":"UNPAID","update_time":1718305585}}
  1. Signature base string:
abcdef{"type":1,"tts_notification_id":"7380066284010030890","shop_id":"7495540735365777507","timestamp":1718305585,"data":{"is_on_hold_order":true,"order_id":"576653688135258178","order_status":"UNPAID","update_time":1718305585}}
  1. App secret:
123
  1. HMAC-SHA256 result:
5dec0f11ec2f6783b8deee53c9ffbf8d024302f7c7e7fa55a35d17629031ac05

Pseudocode:

const crypto = require("crypto");

function verifyWebhookSignature({ appKey, appSecret, rawBody, authorization }) {
  const base = appKey + rawBody;
  const expected = crypto
    .createHmac("sha256", appSecret)
    .update(base, "utf8")
    .digest("hex");

  const expectedBuffer = Buffer.from(expected, "utf8");
  const receivedBuffer = Buffer.from(authorization || "", "utf8");

  return (
    expectedBuffer.length === receivedBuffer.length &&
    crypto.timingSafeEqual(expectedBuffer, receivedBuffer)
  );
}
#

§6 Body parameters

All webhook notifications include common metadata and a topic-specific data object.

Param nameSampleDescription
type1Numeric notification type in the delivered payload. Do not confuse this with the event_type string used when configuring webhook subscriptions.
tts_notification_id7380066284010030890Unique TikTok Shop notification ID. Store this value for idempotency and duplicate-event handling when present.
shop_id7495540735365777507TikTok Shop ID associated with the event. Use this to map the webhook to the local shop connection.
timestamp1718305585Unix timestamp, in seconds, when the notification was pushed.
data{"order_id":"576653688135258178","order_status":"UNPAID","update_time":1718305585}Topic-specific business payload. The fields depend on the webhook topic.
#

§7 Sample request

The sample request below uses the same raw body and signature shown in the reproducible example.

curl --location --request POST 'https://example.com/tiktok-shop/webhooks' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: 5dec0f11ec2f6783b8deee53c9ffbf8d024302f7c7e7fa55a35d17629031ac05' \
  --data-raw '{"type":1,"tts_notification_id":"7380066284010030890","shop_id":"7495540735365777507","timestamp":1718305585,"data":{"is_on_hold_order":true,"order_id":"576653688135258178","order_status":"UNPAID","update_time":1718305585}}'
#