Graphrt

TikTok

TikTok profile, videos and publishing, plus comments and DMs via the Business API

Experimental v0.3.0 Node.js 19 actions ToS risk medium
Use in Graphrt Desktop

About

A Graphrt plugin for the official TikTok APIs. It uses two of them:

What it can do

  • Profile and videos: user info, list videos (cursor paging), query videos by id, creator posting settings
  • Publishing: - Post a video from a URL, directly or as an inbox draft. - Post 1–35 photos, directly or as an inbox upload. - Each publish checks the privacy level against creator_info first, then waits for TikTok to finish (polls every 5 s, up to 5 min).
  • Token refresh (node only): refresh_access_token returns the rotated access and refresh tokens. It isn't offered to agents as a tool, so tokens never reach an LLM
  • Comments (Business API): list, list replies, comment, reply, hide/unhide, like/unlike, delete
  • Messages (Business API): list conversations, list messages, send a text message
  • api_request: any other endpoint, with api: open or api: business, restricted to that API's host
  • TikTok errors are mapped to stable kinds, including errors sent inside HTTP 200 bodies. Tokens never appear in errors.

Actions

Each action is a step you can add to a workflow. Agents can also use most of them as tools.

  • Get TikTok user info tiktok-api.get_user_info
  • List TikTok videos tiktok-api.list_videos
  • Query TikTok videos tiktok-api.query_videos
  • Get TikTok creator info tiktok-api.get_creator_info
  • Refresh TikTok access token tiktok-api.refresh_access_token
  • Publish TikTok video tiktok-api.publish_video
  • Publish TikTok photos tiktok-api.publish_photos
  • Get TikTok publish status tiktok-api.get_publish_status
  • List TikTok comments tiktok-api.list_comments
  • List TikTok comment replies tiktok-api.list_comment_replies
Show all 19 actions
  • Comment on TikTok video tiktok-api.create_comment
  • Reply to TikTok comment tiktok-api.reply_to_comment
  • Hide/unhide TikTok comment tiktok-api.set_comment_hidden
  • Like/unlike TikTok comment tiktok-api.set_comment_liked
  • Delete TikTok comment tiktok-api.delete_comment
  • List TikTok conversations tiktok-api.list_conversations
  • List TikTok messages tiktok-api.list_messages
  • Send TikTok message tiktok-api.send_message
  • TikTok API request tiktok-api.api_request

Settings

Graphrt starts plugins with a clean environment. Only these values reach the plugin, and secrets stay out of logs.

  • TIKTOK_ACCESS_TOKEN For Open API operations
    User access token (Bearer). It is short-lived (see expires_in), refresh it with refresh_access_token
  • TIKTOK_BUSINESS_ACCESS_TOKEN For comment and message operations
    Business API access token (Access-Token header)
  • TIKTOK_BUSINESS_ID For comment and message operations
    Default business_id (the business account's open_id)
  • TIKTOK_CLIENT_KEY For refresh_access_token
    App client key (can also be passed as client_key)
  • TIKTOK_CLIENT_SECRET For refresh_access_token
    App client secret. Env only, never an argument
  • TIKTOK_REFRESH_TOKEN Optional
    Default refresh token for refresh_access_token
  • TIKTOK_TOOL_ALLOW_POST Optional
    1 lets agent tools post directly (mode=direct), comment and reply (see Agent policy)
  • TIKTOK_TOOL_ALLOW_ENGAGE Optional
    1 lets agent tools hide, unhide, like and unlike comments
  • TIKTOK_TOOL_ALLOW_DM Optional
    1 lets agent tools send_message
  • TIKTOK_API_TOOL_TOKEN_SOURCE

How to use it

In Graphrt Desktop

  1. Open Plugins and search for TikTok.
  2. Click Install and approve it.
  3. Follow the setup steps on the plugin's page, then paste the settings it needs.
  4. Describe a job that needs it, and the builder adds the steps.
Plugins in Graphrt Desktop

With the CLI

terminal
$ graphrt plugin install tiktok-api --yes
workflow.yaml
- id: post
  type: tiktok-api.publish_video
  video_url: "https://media.example.com/clips/launch.mp4"
  post_title: "Launch day #fyp"
  privacy_level: SELF_ONLY
- id: reply
  type: tiktok-api.reply_to_comment
  video_id: "{{#start.video_id#}}"
  comment_id: "{{#start.comment_id#}}"
  text: "Thank you!"
Plugins in the docs