> ## Documentation Index
> Fetch the complete documentation index at: https://chatbotx.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# TikTok

> Connect TikTok Business Messaging to ChatbotX to automate chat responses, handle image attachments, and manage conversations.

Connecting your TikTok Business account to ChatbotX allows you to manage customer chat conversations directly from your workspace. Your support agents can receive and reply to TikTok messages, view shared videos, and handle incoming images, all from a single, unified inbox.

## Prerequisites

Before starting the setup, ensure you have:

* A self-hosted ChatbotX instance accessible via a public HTTPS URL.
* A **TikTok Business Account** registered in a supported region (personal TikTok accounts are not supported).
* Direct messages set to **Everyone** in your TikTok app settings (otherwise, you will need to manually accept new message requests).
* A **TikTok Developer Account** created at [developers.tiktok.com](https://developers.tiktok.com/).
* Super Admin access to your ChatbotX instance.

<Warning>
  The TikTok Business Messaging API is region-restricted. It is currently unavailable for accounts registered in the European Economic Area (EEA), Switzerland, or the United Kingdom.
</Warning>

## Step 1: Create a TikTok Developer Account

To get started, you must register a developer account on TikTok. This account lets you manage and configure the messaging link between TikTok and ChatbotX.

<Steps>
  <Step title="Register as a developer">
    Go to [developers.tiktok.com](https://developers.tiktok.com/) and sign up.
  </Step>

  <Step title="Verify account">
    Verify your email address and accept the Terms of Service to complete the registration.
  </Step>
</Steps>

## Step 2: Register Your App

Registering your application in the developer portal provides you with the key credentials (App ID and App Secret) needed to securely link ChatbotX to TikTok.

<Steps>
  <Step title="Create a new app">
    Navigate to [business-api.tiktok.com/portal/apps](https://business-api.tiktok.com/portal/apps) and click **Create App**.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/Vk4pTtGaUIGyb8QP/images/tiktok-create-app.avif?fit=max&auto=format&n=Vk4pTtGaUIGyb8QP&q=85&s=b54313749b78f2f3383b3ea1044c79a5" alt="Tiktok Create App" width="810" height="1009" data-path="images/tiktok-create-app.avif" />
    </Frame>
  </Step>

  <Step title="Fill in app details">
    Provide the required details:

    * **App Name**: e.g., `Your Company - ChatbotX`
    * **App Description**: Explain your messaging and support use case.
    * **App Icon**: Upload your company logo.
    * **Terms of Service URL**: Your company's ToS page.
    * **Privacy Policy URL**: Your company's privacy policy page.
  </Step>

  <Step title="Copy App credentials">
    Once the app is created, copy the **App ID** (Client Key) and **App Secret** (Client Secret). You will need these to configure ChatbotX.
  </Step>
</Steps>

## Step 3: Apply for Business Messaging API Access

TikTok requires you to request access to the messaging endpoints. This is a security review step to ensure data is handled safely.

<Steps>
  <Step title="Request Business Messaging product">
    Open your app in the TikTok Developer Portal and find the **Business Messaging API** product.
  </Step>

  <Step title="Submit the access application">
    Fill out the application form with:

    * Your use case (e.g., providing automated customer support).
    * Details on how you handle user data.
    * Your business/organization details.
  </Step>

  <Step title="Wait for review">
    TikTok reviews the request, which typically takes a few business days. You cannot proceed with the integration until this is approved.
  </Step>
</Steps>

## Step 4: Configure ChatbotX Credentials

With your TikTok credentials generated and Webhooks configured in Meta, save these settings in ChatbotX to link the integration.

<Steps>
  <Step title="Configure via Super Admin Panel">
    Log in to ChatbotX as a Super Admin, then navigate to:

    ```text theme={null}
    https://app.yourdomain.com/admin/platform-credentials
    ```

    Enter your **TikTok App ID** and **TikTok App Secret**
  </Step>

  <Step title="Configure via Super Admin Panel">
    Log in to ChatbotX as a Super Admin, then navigate to:

    ```text theme={null}
    https://app.yourdomain.com/admin/platform-credentials
    ```

    Enter your **TikTok App ID** and **TikTok App Secret**
  </Step>

  <Step title="Open the TikTok configuration">
    Click the **Edit** button on the TikTok card to open the configuration modal. Enter your **Client ID** and **App Secret**

    <Frame>
      <img src="https://mintcdn.com/chatbotx/Vk4pTtGaUIGyb8QP/images/chatbotx_super_admin_tiktok_edit.png?fit=max&auto=format&n=Vk4pTtGaUIGyb8QP&q=85&s=20b7ce7c7e3b1c31598af790ba621dc9" alt="Chatbotx Super Admin Tikotk Edit" width="2102" height="1286" data-path="images/chatbotx_super_admin_tiktok_edit.png" />
    </Frame>
  </Step>

  <Step title="Click Save. TikTok will now be available as a channel when creating chatbots.">
    After saving, ChatbotX will display a **Webhook URL**. Use it in Step 5.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/Vk4pTtGaUIGyb8QP/images/chatbotx_super_admin_integrations_tiktok.png?fit=max&auto=format&n=Vk4pTtGaUIGyb8QP&q=85&s=43cef9c6b43492ff3663fae5ab06b590" alt="Tiktok Create App" width="1027" height="896" data-path="images/chatbotx_super_admin_integrations_tiktok.png" />
    </Frame>
  </Step>
</Steps>

## Step 5: Configure App Permissions and Redirect URLs

Once approved, you need to enable the specific account permissions and tell TikTok where to send users after they log in (Redirect URL).

<Steps>
  <Step title="Enable permissions">
    Ensure the **TikTok Accounts** permission scope is enabled in your app settings.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/Vk4pTtGaUIGyb8QP/images/tiktok-accounts-permission.avif?fit=max&auto=format&n=Vk4pTtGaUIGyb8QP&q=85&s=4cfcafa295101109e5c7f40ec352f0c2" alt="Tiktok Accounts Permission" width="990" height="887" data-path="images/tiktok-accounts-permission.avif" />
    </Frame>
  </Step>

  <Step title="Add redirect URL">
    Set the Redirect URL to:

    ```text theme={null}
    https://app.yourdomain.com/integrations/tiktok/webhook
    ```
  </Step>
</Steps>

## Step 6: Connect Your TikTok Account

With the technical setup finished, you can now link your actual TikTok Business account to ChatbotX.

<Steps>
  <Step title="Open Channels Settings">
    In your ChatbotX dashboard, go to **Settings** -> **Channels**, expand the **TikTok** section, and click **+ Add TikTok**.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/PKlyD4ImUrCzLMJu/images/tiktok-channel-setup.png?fit=max&auto=format&n=PKlyD4ImUrCzLMJu&q=85&s=dbe18efed2c8427d34f07b74f93104bc" alt="Tiktok Channel Setup" width="2973" height="1481" data-path="images/tiktok-channel-setup.png" />
    </Frame>
  </Step>

  <Step title="Authorize ChatbotX on TikTok">
    On the TikTok authorization screen, review the requested permissions and click **Tiếp tục** (Continue) to authorize the integration.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/s-dslZH-WMadaj4U/images/tiktok-authorize-popup.png?fit=max&auto=format&n=s-dslZH-WMadaj4U&q=85&s=017bde1a704911ac5764329a26170e43" alt="Tiktok Authorize Popup" width="2974" height="1820" data-path="images/tiktok-authorize-popup.png" />
    </Frame>
  </Step>

  <Step title="Verify connection in ChatbotX">
    After authorization succeeds, you will be redirected back to the ChatbotX dashboard. Confirm that the TikTok channel appears on the dashboard page, and click **Test Now** to verify.

    <Frame>
      <img src="https://mintcdn.com/chatbotx/s-dslZH-WMadaj4U/images/tiktok-connected-dashboard.png?fit=max&auto=format&n=s-dslZH-WMadaj4U&q=85&s=bfc7b82c850f20f800f86a87ad2cebbc" alt="Tiktok Connected Dashboard" width="2927" height="1632" data-path="images/tiktok-connected-dashboard.png" />
    </Frame>
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="TikTok Channel not appearing in dashboard">
    Verify that you have enabled the TikTok feature for your account in the Super Admin panel, and confirm that the environment variables are saved and the server has been restarted.
  </Accordion>

  <Accordion title="OAuth authorization fails">
    Check that the authorization redirect URL in your TikTok Developer Portal exactly matches your ChatbotX domain (`https://app.yourdomain.com/tiktok/callback`). Ensure that the Business Messaging API product is marked as approved.
  </Accordion>

  <Accordion title="Not receiving incoming messages">
    Run `Tiktok::AuthClient.webhook_callback` in the Rails console to verify that the webhook is registered. Check that your server can receive public HTTPS requests and that your business account is registered in a supported region.
  </Accordion>

  <Accordion title="Messages failing to send">
    Ensure you are replying within the standard 48-hour window. Verify the channel is not requesting reauthorization due to expired access tokens.
  </Accordion>

  <Accordion title="Channel requires Reauthorization">
    Refresh tokens expire after 30 days of inactivity. Go to **Settings: Inboxes**, select your TikTok inbox, click **Reauthorize**, and complete the OAuth flow again to restore the connection.
  </Accordion>
</AccordionGroup>
