Integrating and Using the Ctrip WenDao (WorkBuddy) Skill: A Complete Guide

This guide details the end‑to‑end process for developers to integrate the Ctrip WenDao (WorkBuddy) skill, covering environment prerequisites, API token acquisition, configuration methods, command‑line usage, response parsing, common scenarios, security considerations, and troubleshooting steps.

Ctrip Technology
Ctrip Technology
Ctrip Technology
Integrating and Using the Ctrip WenDao (WorkBuddy) Skill: A Complete Guide

Skill Overview

Core Capability : Handles travel queries (hotel, flight, attraction, itinerary, visa) by calling the Ctrip WenDao API and returning professional travel information; does not use a generic knowledge base.

Core Constraint : After trigger only the WenDao API may be used; the API response field result is displayed to the user, while events, messages and state are internal logs and are not shown.

Prerequisites

Node.js version 18 or higher.

Internet access to https://externalcallback.ctrip.com.

Obtain an API Token from the Ctrip WenDao Open Platform at https://www.ctrip.com/wendao/openclaw, follow the on‑screen instructions, and keep the token confidential.

Environment Configuration (Token Setup)

The API token is supplied via the environment variable WENDAO_API_KEY, which has higher priority than any temporary token passed on the command line.

Temporary configuration (current session)

macOS/Linux: export WENDAO_API_KEY='YOUR_API_TOKEN' Windows CMD: set WENDAO_API_KEY=YOUR_API_TOKEN Windows PowerShell:

$env:WENDAO_API_KEY="YOUR_API_TOKEN"

Permanent configuration

macOS/Linux – add to a shell profile such as ~/.zshrc or ~/.bash_profile:

echo 'export WENDAO_API_KEY="YOUR_API_TOKEN"' >> ~/.zshrc
source ~/.zshrc

Windows – add a user environment variable named WENDAO_API_KEY via System → Advanced system settings → Environment Variables.

Hosted environment (OpenClaw, Tencent Cloud, etc.)

Add WENDAO_API_KEY with the token value in the platform’s skill environment variable page.

Skill Usage

Script location: scripts/wendao_query.js inside the skill directory.

Execution methods

Pass query as a command‑line argument :

# node scripts/wendao_query.js "User travel query"
node scripts/wendao_query.js "Book a hotel near Sanlitun tomorrow, budget 800‑1200 CNY"

Pass query via an environment variable :

WENDAO_QUERY="Plan a 7‑day Japan honeymoon" node scripts/wendao_query.js

Provide a temporary token at execution time (if not pre‑configured):

# macOS/Linux
WENDAO_API_KEY="YOUR_TOKEN" node scripts/wendao_query.js "Search Beijing‑Shanghai high‑speed train"

# Windows CMD
set WENDAO_API_KEY=YOUR_TOKEN && node scripts/wendao_query.js "Search Beijing‑Shanghai high‑speed train"

# Windows PowerShell
$env:WENDAO_API_KEY="YOUR_TOKEN"; node scripts/wendao_query.js "Search Beijing‑Shanghai high‑speed train"

Script parameters

WENDAO_API_KEY

(required): API authentication token; priority: environment variable > temporary command‑line token. USER_QUERY (required): User’s natural‑language travel query (e.g., “Summer trip to Chengdu attractions”). timeout (optional): API request timeout in seconds, default 30 s (handled internally).

Result output

After execution the console prints the result field from the API response in Markdown format; this is the user‑facing travel information.

Common Scenario Examples

Hotel booking:

node scripts/wendao_query.js "Shanghai Bund five‑star hotel, budget 800‑1200 CNY"

Flight search:

node scripts/wendao_query.js "Tomorrow Beijing to Shanghai flight, prefer Air China"

Attraction recommendation:

node scripts/wendao_query.js "Family‑friendly attractions near Chengdu"

Itinerary planning:

node scripts/wendao_query.js "7‑day Japan honeymoon itinerary, include Tokyo and Kyoto"

Visa inquiry:

node scripts/wendao_query.js "2024 Thailand tourist visa process and required documents"

API Response Parsing

API returns JSON such as:

{
  "result": "Markdown formatted reply string",
  "messages": [...],
  "state": {"token": "...", "query": "..."},
  "events": [...],
  "error": null
}

The script extracts the result field. If result is a string, it is output directly. If it is an object, the script attempts to read result.content; if absent, it falls back to a JSON string representation.

Security and Compliance

Domain verification: send requests only to https://externalcallback.ctrip.com.

Permissions & billing: confirm token scope, billing rules, and QPS/quota limits.

Content handling: API responses may contain links or marketing copy; decide per product policy whether to display, filter, or summarize.

Troubleshooting

Missing token or query

Check that WENDAO_API_KEY is set and non‑empty.

Verify that the user query is passed (command‑line argument or WENDAO_QUERY environment variable) and non‑empty.

HTTP errors (e.g., 401/403)

Validate that the token is correct and not expired.

Ensure the token’s permissions cover the requested scenario (hotel, flight, visa, etc.).

No or unexpected output

Confirm the result field in the API response contains a value.

Verify Node.js version is ≥ v18 to avoid compatibility issues.

Skill Trigger Rules

The skill automatically triggers when the user query contains any of the following patterns:

Travel‑related action words (Chinese or English) plus a scene keyword, e.g., “预订酒店”, “search flight”, “行程规划”, “visa application”.

Travel scenario modifiers such as “family trip”, “business travel”, “Golden Week”, “honeymoon”.

Specific destination plus context, e.g., “Beijing to Shanghai high‑speed train”, “hotels in Shanghai”.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Node.jsAPICtripTravelWenDao
Ctrip Technology
Written by

Ctrip Technology

Official Ctrip Technology account, sharing and discussing growth.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.