name: tencentads-creatives description: 騰訊營銷(原騰訊廣告)展示廣告管理 - 創意管理。用於管理動態創意(dynamic_creatives)和創意形式(creative_template),以及素材標籤(material_labels)。當用戶需要建立或管理廣告創意(含元件欄位填寫/稽核詳情)、或管理素材標籤(素材標籤查詢、新建、更新和素材繫結)時使用此技能。排除搜尋創意(search_dynamic_creatives)。 license: MIT. See LICENSE for full terms. compatibility: any metadata: author: DeliveryX Team version: "0.5.8" icon: megaphone category: tencent-ads
前置依賴:執行指令碼前需安裝 CLI —
npm install tencentads-cli@1.0.0(需要 Node.js ≥ 20)
管理騰訊廣告展示廣告的動態創意(元件化創意)。
重要提示: 本技能基於騰訊廣告營銷 API(api.e.qq.com)API v3.0 展示廣告介面。 - 以本文件和官方文件為準: 欄位名稱、引數結構可能與舊版或其他廣告平臺不同,請勿依賴舊經驗。 - 序列執行約束: 同一廣告組下,創意的新建、更新和刪除操作必須序列執行,不可併發。 - 禁止修改使用者意圖: 使用者明確指定的引數值必須原樣傳遞,嚴禁靜默修改或忽略。若使用者要求的引數值指令碼不支援,必須明確報錯告知使用者,不得擅自使用預設值替代。
指令碼呼叫格式為 node scripts/<指令碼名>.mjs '<JSON引數>',但 JSON 引數的引號包裹方式因作業系統/終端而異,傳遞不當會導致 JSON.parse 報錯(如 Expected property name or '}' in JSON at position 1)。
| 終端環境 | 正確寫法 | 說明 |
|---|---|---|
| Linux / macOS (Bash/Zsh) | node scripts/xxx.mjs '{"key":"value"}' |
✅ 單引號包裹,內部雙引號原樣保留 |
| Windows Git Bash | node scripts/xxx.mjs '{"key":"value"}' |
✅ 同 Bash |
| Windows CMD | node scripts/xxx.mjs "{\"key\":\"value\"}" |
✅ 雙引號包裹 + 反斜槓轉義 |
| Windows CMD (備選) | node scripts/xxx.mjs "{""key"":""value""}" |
✅ 雙引號包裹 + 雙雙引號轉義 |
| Windows PowerShell 5.x | node --% scripts/xxx.mjs "{\"key\":\"value\"}" |
✅ 必須加 --% 停止解析符 |
| Windows PowerShell 5.x (備選) | node scripts/xxx.mjs "{\`"key\`":\`"value\`"}" |
✅ 反斜槓 + 反引號組合轉義 |
⛔ PowerShell 5.x 是重災區:單引號
'...'、反引號`"、反斜槓\"三種常見寫法全部失敗(雙引號會被吞掉)。必須使用--%停止解析符或\`"組合轉義。 ⛔ Windows CMD 不支援單引號包裹字串,單引號會被當作普通字元傳入指令碼,導致 JSON 解析失敗。
| 指令碼 | 功能 | 必填引數 | 可選引數 |
|---|---|---|---|
scripts/create-creative.mjs |
建立動態創意(自動校驗必填欄位及創意數量上限,須先呼叫 build-creative-params.mjs 完成引數預處理) | account_id, adgroup_id, creative_components | - |
scripts/update-creative.mjs |
更新動態創意 | account_id, dynamic_creative_id | creative_components |
scripts/delete-creative.mjs |
刪除動態創意 | account_id, dynamic_creative_id | - |
scripts/get-component-list.mjs |
按元件子型別查詢賬戶下可用元件列表 | account_id, component_sub_types | - |
scripts/get-components.mjs |
查詢元件庫(按型別拉取可用元件列表) | account_id, component_type | - |
scripts/get-creative-templates.mjs |
查詢可用創意形式,輸出元件摘要 | account_id, adgroup_id | creative_template_id, dynamic_creative_type, delivery_mode, live_promoted_type |
scripts/get-creative-template-list.mjs |
查詢可用創意形式列表(含 live_promoted_type_list) | account_id | adgroup_id |
scripts/get-component-depends.mjs |
查詢元件欄位聯動約束,輸出依賴摘要(含合法列舉值) | account_id, adgroup_id, component_type | creative_template_id, dynamic_creative_type, delivery_mode, live_promoted_type |
scripts/query-adgroup-context.mjs |
查詢廣告組上下文(marketing_asset_outer_spec 等) | account_id, adgroup_id | - |
scripts/get-creative.mjs |
查詢動態創意詳情(含 creative_components 完整結構) | account_id, dynamic_creative_id | fields |
scripts/build-creative-params.mjs |
構建並校驗創意請求引數(不發起建立,輸出 params+warnings+errors) | account_id, adgroup_id, creative_components | adgroup_context, creative_template_id, live_promoted_type, impression_tracking_url, click_tracking_url |
scripts/get-playable-pages.mjs |
查詢小遊戲試玩頁列表,獲取 playable_page_path |
account_id, app_id | - |
scripts/get-project-assets.mjs |
查詢全店託管商品列表(獲取 marketing_asset_id) | account_id, project_id(廣告組ID) | - |
scripts/upload-image.mjs |
上傳圖片到素材庫(jpg/png/gif,≤10MB),返回 image_id | account_id, file_path | description, image_usage |
scripts/get-images.mjs |
查詢素材庫圖片列表(按 ID 確認素材存在/查詳情) | account_id | filtering, page, page_size |
scripts/upload-video-svp.mjs |
上傳影片到素材庫(SVP分片上傳,支援大檔案、斷點續傳) | account_id, file_path | description, concurrent, chunk_size, timeout |
scripts/get-videos.mjs |
查詢素材庫影片列表(按 ID 確認/查轉碼狀態 system_status) | account_id | filtering, page, page_size |
scripts/get-integrated-components.mjs |
元件模式查詢素材(含報表排序、起量潛力/首發/低質篩選) | account_id, component_sub_types | sort_field, sort_type, date_range, fuzzy_name, potential_status, first_publication_status, quality_status, generation_type, page, page_size, organization_id |
scripts/get-integrated-media.mjs |
素材庫模式查詢單圖/影片(含可用性過濾、報表排序、多維篩選) | account_id, type | sort, sort_type, date_range, create_range, ratios, ratio_valids, fuzzy_name, label_id, similarity_status, quality_status, first_publication_status, generation_type, duration, watermark, page, page_size, organization_id |
scripts/get-audios.mjs |
查詢妙思版權音訊列表 | account_id | fields, page, page_size |
scripts/get-dc-review-result.mjs |
查詢動態創意稽核詳情(含元件/元素稽核結果、駁回原因、元件組合稽核資訊) | account_id, dynamic_creative_id | need_return_has_violation_reason_interpretation |
scripts/dynamic-product-templates/get-dynamic-ad-image-templates.mjs |
查詢動態商品圖片模版列表(MPA/DPA),返回可選模版 | account_id, product_catalog_id, product_mode, dynamic_ad_template_width, dynamic_ad_template_height | dynamic_ad_template_ownership_type, template_id_list, template_name |
scripts/dynamic-product-templates/generate-dynamic-ad-image.mjs |
從商品圖片模版生成圖片,返回 image_id | account_id, product_catalog_id, product_mode, product_source, dynamic_ad_template_id, dynamic_ad_template_size | remove_template_id |
scripts/dynamic-product-templates/get-dynamic-ad-video-templates.mjs |
查詢動態商品影片模版列表(MPA/DPA),返回可選模版 | account_id, product_catalog_id, adcreative_template_id, product_mode | support_channel, template_id_list, template_name |
scripts/dynamic-product-templates/generate-dynamic-ad-video.mjs |
從商品影片模版生成影片,返回 video_id | account_id, product_catalog_id, product_mode, product_source, dynamic_ad_template_id | - |
scripts/get-material-labels.mjs |
查詢賬號下素材標籤列表(圖片/影片標籤) | account_id 或 organization_id | label_id, label_name, business_scenario, page, page_size, need_count 等 |
scripts/add-material-labels.mjs |
批次新建素材標籤(一/二級類目、業務場景) | account_id 或 organization_id, labels | - |
scripts/update-material-labels.mjs |
更新單個素材標籤的名稱或一/二級類目 | account_id 或 organization_id, label_id, label_name | first_label_level_name, second_label_level_name |
scripts/bind-material-labels.mjs |
把圖片/影片素材與標籤建立繫結關係(覆蓋/新增/解除) | account_id 或 organization_id, label_id_list, image_id_list 或 media_id_list 至少一個 | binding_type, business_scenario |
若使用者已有 image_id / video_id / component_id,直接跳到工作流一。
當用戶需要上傳新素材或查詢現有素材時,按以下方式操作。
# 上傳圖片
node scripts/upload-image.mjs '{"account_id":"123456789","file_path":"/tmp/banner.jpg"}'
# 上傳影片
node scripts/upload-video-svp.mjs '{"account_id":"123456789","file_path":"/tmp/ad.mp4"}'
返回 image_id / video_id。影片上傳後需轉碼,可用 get-videos.mjs 輪詢 system_status 確認轉碼完成(MEDIA_STATUS_VALID)後再建立創意。
檔案格式限制:圖片 jpg/png/gif(≤10MB,GIF ≤5秒);影片 mp4/mov/avi(≤100MB,微信廣告需 Progressive 掃描)。
詳細介面規範:素材介面文件
提供兩種查詢方式,根據使用者需求選擇:
按素材粒度查詢單圖/影片,支援可用性過濾(比例+寬高+時長)、報表排序、標籤/首發/相似度等篩選。
# 查詢 16:9 可用影片,按消耗排序
node scripts/get-integrated-media.mjs '{"account_id":"123456789","type":"VIDEO","sort":"cost","ratios":["16:9"],"ratio_valids":[{"ratio":"16:9","file_size_kb_limit":102400,"min_width":1280,"min_height":720,"min_duration":6,"max_duration":900}]}'
# 按名稱模糊搜尋圖片
node scripts/get-integrated-media.mjs '{"account_id":"123456789","type":"IMAGE","fuzzy_name":"產品主圖"}'
詳細引數說明:integrated-media-get.md
按元件粒度查詢,支援按消耗/曝光/ROI 排序,支援起量潛力/首發/低質等篩選。返回 component_id 可直接用於 creative_components。
# 查詢影片元件,按消耗排序
node scripts/get-integrated-components.mjs '{"account_id":"123456789","component_sub_types":["VIDEO_16X9","VIDEO_9X16"],"sort_field":"report.cost","sort_type":"DESCENDING"}'
# 查詢高潛圖片元件
node scripts/get-integrated-components.mjs '{"account_id":"123456789","component_sub_types":["IMAGE_16X9"],"potential_status":["COMMON_POTENTIAL_STATUS_HIGH"]}'
詳細引數說明:integrated-components-get.md
node scripts/get-audios.mjs '{"account_id":"123456789"}'
當需要使用商品庫素材時,可通過商品模版生成圖片或影片。此流程是獨立的素材生產流程,與廣告組型別無關——只要賬戶有可用的 product_catalog_id 即可使用,生成的 image_id / video_id 是通用素材資產,可用於任意廣告組的創意。
判斷標識:
get-creative-templates.mjs輸出中若包含support_mpa_image_template: true,則圖片元件支援商品模版;support_mpa_video_template: true,則影片元件支援商品模版。MPA 廣告組約束:若廣告組為 MPA 模式(
mpa_spec非空),則該廣告組的 image/video 元件只能通過商品模版生成,不支援本地上傳素材。此約束僅適用於 MPA 廣告組內部,不影響商品模版功能本身的使用範圍。
| 引數 | 來源 | 說明 |
|---|---|---|
product_catalog_id |
adgroup.product_spec.product_catalog_id(廣告組欄位)或使用者已知的商品庫 ID |
商品庫ID |
product_source |
mpa_spec.product_series_id(優先)或 marketing_asset_outer_spec.marketing_asset_outer_sub_id |
商品系列/單品來源ID |
product_mode |
MPA 廣告組(mpa_spec 非空)→ MULTIPLE;其他情況 → SINGLE |
動態廣告模式 |
dynamic_ad_template_width/height |
get-creative-templates 輸出中 image 元件的尺寸(如 sub_types 中的 width/height) |
圖片尺寸要求 |
dynamic_ad_template_size |
格式: SIZE_{width}_{height}(如 SIZE_1280_720) |
圖片生成尺寸列舉 |
get-creative-templates.mjs 輸出中確認 support_mpa_image_template: true,並獲取 image 元件的尺寸要求bash
node scripts/dynamic-product-templates/get-dynamic-ad-image-templates.mjs '{"account_id":"123","product_catalog_id":456,"product_mode":"MULTIPLE","dynamic_ad_template_width":1280,"dynamic_ad_template_height":720}'bash
node scripts/dynamic-product-templates/generate-dynamic-ad-image.mjs '{"account_id":"123","product_catalog_id":456,"product_mode":"MULTIPLE","product_source":"789","dynamic_ad_template_id":12345,"dynamic_ad_template_size":"SIZE_1280_720"}'image_id 用於 creative_components 中 image/image_list 等元件小蔥技能站7w4.net,專業的AI技能分享平臺。
get-creative-templates.mjs 輸出中確認 support_mpa_video_template: truetemplate_id):
bash
node scripts/dynamic-product-templates/get-dynamic-ad-video-templates.mjs '{"account_id":"123","product_catalog_id":456,"adcreative_template_id":720,"product_mode":"MULTIPLE"}'bash
node scripts/dynamic-product-templates/generate-dynamic-ad-video.mjs '{"account_id":"123","product_catalog_id":456,"product_mode":"MULTIPLE","product_source":"789","dynamic_ad_template_id":67890}'video_id 用於 creative_components 中 video 元件(video_preview_image_id 可作為 cover_id)注意: - 生成的
image_id/video_id後續流程與普通素材完全一致——傳入creative_components對應元件的 value 即可 - 若product_source為空(mpa_spec.product_series_id和marketing_asset_outer_sub_id均無值),需傳0
詳細介面規範:動態商品模版介面文件
adgroup_id 必須由使用者提供,或在上下文中已知。
每次建立創意前,必須先查詢廣告組上下文,幫助理解廣告組的資訊:
node scripts/query-adgroup-context.mjs '{"account_id":"123456789","adgroup_id":987654321}'
始終執行以下命令獲取可用創意形式列表(含 live_promoted_type_list):
node scripts/get-creative-template-list.mjs '{"account_id":"123456789","adgroup_id":987654321}'
live_promoted_type 填寫規則(live_promoted_type_list 來自上述命令輸出):
live_promoted_type_list 不為空 → 必須填寫 live_promoted_type(頂層引數,與 creative_components 同級):LIVE_PROMOTED_TYPE_SHORT_VIDEO(落地頁為影片號直播間、影片號主頁等均用此值)LIVE_PROMOTED_TYPE_NATIVE_VIDEOPAGE_TYPE_WECHAT_CHANNELS_WATCH_LIVE 不代表 NATIVE_VIDEO,仍填 SHORT_VIDEOlive_promoted_type_list 為空/null → 不填此欄位若使用者指定了 creative_template_id,須確認該 ID 在上述返回列表中,不在則攔截並告知使用者。若使用預設(template_id=0,不指定創意形式),則跳過此驗證。
始終執行以下命令獲取元件列表摘要(若使用者未指定 creative_template_id,預設使用 template_id=0,不指定創意形式,required=false 的可選元件預設不加):
⚠️ 可選元件規則:
required=false的元件(如浮層floating_zone/floating_zone_list、標籤label、社互動動social_skill、資料外顯show_data等)未經使用者許可禁止自行構建和新增。僅在使用者明確要求該元件時才加入。
node scripts/get-creative-templates.mjs '{"account_id":"123456789","adgroup_id":987654321}'
對結果中所有 has_depend=true 的元件,逐一呼叫以下命令查詢聯動約束:
node scripts/get-component-depends.mjs '{"account_id":"123456789","adgroup_id":987654321,"component_type":"WECHAT_CHANNELS"}'
若 depends 為空陣列,說明該元件無聯動約束,可直接填寫。若命令返回失敗或 Mock not found,忽略該錯誤,直接跳到第三步繼續。
若 get-creative-templates.mjs 輸出包含 support_impression_tracking_url: true 或 support_click_tracking_url: true,說明該創意形式支援第三方監測連結,使用者提供時將其作為頂層引數傳入後續指令碼。詳見 dynamic-creatives-add.md。
與上方頂層監測連結不同,mini_game_tracking_parameter 是小遊戲落地頁(PAGE_TYPE_WECHAT_MINI_GAME)專屬欄位,位於 wechat_mini_game_spec 內部。使用者描述落地頁時若提供了"監測連結"(如 ?state=xxx、?gameplay_concept=1),必須將其填入對應 jump_info 的 page_spec.wechat_mini_game_spec.mini_game_tracking_parameter。
main_jump_info、action_button、text_link、mini_card_link 等所有包含小遊戲落地頁的 jump_infomini_game_tracking_parameter 應保持一致(使用使用者提供的值)關鍵:
component_depends/get響應中,target_options[].support_options[].value是該欄位唯一合法的列舉值,必須直接使用,不可憑經驗填寫其他列舉名。例如show_data.conversion_data_type的值只能取support_options中列出的(如CONVERSION_DATA_ADMETRIC),而非CONVERSION_DATA_TYPE_CONVERSION等臆測值。
第二步的摘要輸出中,每個元件包含 sub_types 欄位(如 ["BRAND"]、["VIDEO_16X9","VIDEO_9X16",...])。如使用者未提供 component_id,呼叫以下命令按元件子型別查詢賬戶下可用元件:
node scripts/get-component-list.mjs '{"account_id":"123456789","component_sub_types":["BRAND"]}'
component_sub_types 填對應元件的 sub_types 值,同類型有多個 sub_type 時一次性全部傳入(如 ["BRAND","BRAND_WECHAT_CHANNEL"]),不要拆開多次呼叫integrated_list 無資料,改用 get-components.mjs fallback 查詢:
bash
node scripts/get-components.mjs '{"account_id":"123456789","component_type":"BRAND"}'
若仍為空,才告知使用者該型別元件不存在。0、null、-1 等無效值佔位 component_id:查詢失敗的元件條目整體省略,不填虛假 ID。[{}](空物件陣列)——這會讓 API 收到無效的空影片條目。查詢失敗時直接整體省略 video,或告知使用者提供影片 ID。image_showcase / video_showcase 是複合展示位,value 內巢狀 image/video + image_list,不能拆成獨立元件分別傳入。詳見 references/creative-components.md獲取到元件列表後,按以下規則決策,嚴禁隨機取第一個:
wechat_channels 型 brand)→ 直接使用component_custom_name)讓使用者選擇,不可自行決定若使用者提供了 component_id 但查詢結果中不存在該 ID,應立即告知使用者,不可繼續使用該 ID 建立。
get-component-list.mjs 返回的 brand 條目含 brand_type 欄位,是第3條"意圖可唯一確定"判斷的依據:
| brand_type | 含義 | 適用場景 |
|---|---|---|
common |
普通品牌形象(brand_name + brand_image_id) | 小遊戲、APP 等非影片號場景 |
wechat_channels |
影片號品牌形象(含影片號 jump_info) | 影片號投放場景 |
h5_profile |
品牌簡介(H5 主頁) | H5 場景 |
search_brand |
搜一搜超級品專 | 搜尋場景 |
wechat_official |
公眾號品牌形象 | 公眾號場景 |
wecom |
企業微信 | 企業微信場景 |
先按當前投放場景過濾出匹配 brand_type 的元件,再套用上方通用規則。過濾後為空時,告知使用者當前場景下無對應型別品牌元件,詢問如何處理。
wechat_channels 元件(影片號賬號)完全由指令碼自動處理,禁止 Agent 在 creative_components 中傳入 wechat_channels 鍵。指令碼會按以下路徑自動推斷:
adgroups/get 獲取 marketing_asset_outer_spec.marketing_asset_outer_id(v2_xxx@finder 格式);也可通過 adgroup_context 引數傳入brand inline value:若 brand 以 inline value 傳入且 jump_info.page_type == PAGE_TYPE_WECHAT_CHANNELS_PROFILE,從 wechat_channels_profile_spec.username 提取brand 攜帶 wechat_channels_username 臨時欄位:直接使用wechat_channels_accounts/get 獲取賬號列表,自動選擇(多賬號時先結合 video_id 過濾,再結合名稱匹配消歧)多賬號消歧:當用戶在品牌元件中指定了影片號名稱(如"影片號profile頁(影片號名稱: A+肖像攝影門店)"),Agent 應在 brand 的 inline value 中攜帶
wechat_channels_account_name臨時欄位,指令碼會用它在多個可用賬號中精確匹配。⚠️ 禁止手動填寫以下欄位(全部由指令碼自動處理): -
wechat_channels元件本身:❌ 不要在creative_components中包含wechat_channels鍵,指令碼自動生成 -wechat_channels_account_id(export/xxx格式):指令碼自動從 brand profile_spec 或 API 獲取並補全 -finder_object_visibility:指令碼根據是否存在export/賬號自動決定是否新增 -live_promoted_type:頂層引數(與creative_components同級),❌ 禁止寫入wechat_channels.value
組裝好 creative_components 後,先呼叫 build-creative-params.mjs 進行預處理和校驗(不發起建立):
node scripts/build-creative-params.mjs '{
"account_id": "123456789",
"adgroup_id": 987654321,
"live_promoted_type": "LIVE_PROMOTED_TYPE_SHORT_VIDEO",
"creative_components": {
"video": [{ "component_id": 1905866436402 }],
"brand": [{ "component_id": 1895897993168 }],
"description": [{ "value": { "content": "限時優惠,立即瞭解" } }],
"action_button": [{ "value": { "button_text": "檢視詳情", "jump_info": { "page_type": "PAGE_TYPE_OFFICIAL", "page_spec": { "official_spec": { "page_id": 3767098217 } } } } }],
"main_jump_info":[{ "value": { "page_type": "PAGE_TYPE_OFFICIAL", "page_spec": { "official_spec": { "page_id": 3767098217 } } } }]
}
}'
處理輸出結果:
errors 非空 → 引數有問題,逐項修正後重調此指令碼,不得直接進入建立步驟warnings 非空 → 向用戶說明,確認後繼續(如自動補全失敗、cover_id 未查到等)errors 為空 → 繼續第四步B,將 params 直接傳給 create-creative.mjs欄位傳遞規則:
欄位 使用者未指定時 使用者明確指定時 說明 delivery_mode指令碼預設 DELIVERY_MODE_COMPONENT必須傳入使用者指定的值(如 DELIVERY_MODE_CUSTOMIZE)使用者說"自定義創意"→傳 CUSTOMIZE,"元件化創意"或不提→不傳dynamic_creative_type根據 creative_template_id自動推斷(0→PROGRAM,>0→COMMON)必須傳入使用者指定的值(如 DYNAMIC_CREATIVE_TYPE_PROGRAM)使用者說"自動匹配"/"程式化"→傳 PROGRAM,"指定創意形式"→傳COMMONdynamic_creative_name指令碼自動生成 傳入使用者提供的名稱 未提供時不傳,由指令碼生成 wechat_channels指令碼自動推斷 禁止 Agent 傳入,由指令碼處理 無論從 brand 還是廣告組上下文推斷 video.cover_id自動查詢補全 傳入使用者指定的 cover_id 未提供時指令碼自動查詢 impression_tracking_url/click_tracking_url不傳 原樣透傳使用者提供的值 校驗長度不超過 1024 字元 smart_delivery_spec指令碼自動從廣告組獲取 傳入使用者選擇的商品 ID 全店託管場景必填 configured_status不傳(由系統預設) 必須傳入使用者指定的值 使用者說"狀態:有效"→傳 AD_STATUS_NORMAL,"狀態:暫停"→傳AD_STATUS_SUSPENDauto_derived_program_creative_switch不傳 傳入使用者指定的開關值 true開啟自動衍生program_creative_info【不支援】 【當前不支援】傳入會報錯 需根據素材動態生成,暫不支援使用者傳入 site_set_validate_model不傳 傳入使用者指定的校驗模式 如 SITE_SET_VALIDATE_MODEL_STRICTpage_track_url不傳 原樣透傳使用者提供的值 校驗長度不超過 1024 字元 關鍵原則:使用者明確指定了引數值(如"投放模式:自定義創意"、"動態創意型別:自動匹配"),Agent 必須將該值傳入
build-creative-params.mjs,不要依賴指令碼預設值。
創意數量上限:每個廣告組下最多建立 100 個創意(僅自定義創意允許 1000)。
create-creative.mjs在發起建立前會自動查詢已有創意數量,超限時攔截並返回錯誤,無需 Agent 額外處理。若使用者遇到上限提示,應引導其先刪除部分已有創意後重試。
將第四步A輸出的 params 直接傳入 create-creative.mjs:
node scripts/create-creative.mjs '<第四步A輸出的 params JSON>'
⚠️ 文案含引號時:改用 heredoc 方式(引號無需轉義):
bash node scripts/create-creative.mjs <<'EOF' { "account_id": "123456789", "adgroup_id": 987654321, "creative_components": { "description": [{ "value": { "content": "別再誇"聰明",要誇這一點" } }] } } EOF
元件 value 欄位填寫原則:
- 內聯 value 時,嚴格按使用者為該元件明確提供的資訊填寫,不得從其他元件的引數推斷/複製欄位
- 只傳使用者明確指定的欄位,多餘欄位即使看似合理也應省略
- 元件可用欄位以 get-creative-templates 輸出的 fields 為準,未在 fields 中列出的欄位不得填寫
- 中文名到欄位名對映:使用者用中文描述元件(如"多卡輪播"、"賣點圖")時,在 creative-components.md 的「常用元件型別」表格 中根據「中文名」查詢對應的「元件型別」(即欄位名)
jump_info 巢狀結構說明:
所有包含跳轉連結的元件(action_button, brand, mini_card_link 等)的 jump_info 欄位採用 page_type + page_spec.<spec名> 巢狀結構,不能平鋪。
{ "page_type": "PAGE_TYPE_OFFICIAL", "page_spec": { "official_spec": { "page_id": 123 } } }page_type → page_spec 完整對映(含每種 page_type 的 page_spec 結構示例)見 references/enums.md。
creative_components 格式規則及各元件詳解見 references/creative-components.md。
dynamic_creative_name 命名規則: - 使用者明確提供了創意名稱 → 傳入該名稱 - 使用者未提供 → 無需傳入,指令碼自動生成含北京時間時間戳的預設名
返回(成功): { "success": true, "dynamic_creative_id": 8362490722 }
介面詳情見: references/dynamic-creatives-add.md
dynamic_creative_id 必須由使用者提供,或在上下文中已知。
無論使用者描述了哪些元件,都必須先呼叫以下命令查詢創意當前狀態:
node scripts/get-creative.mjs '{"account_id":"123456789","dynamic_creative_id":111222333}'
返回的 creative.creative_components 即為當前完整結構,更新時須以此為基礎修改(全量覆蓋)。使用者只描述了要改哪些元件,其餘元件必須從此處獲取後原樣保留。
注意:
creative_components為全量覆蓋,需基於第一步獲取的完整結構修改,不可只傳要變更的部分。
如何從 GET 結果構造更新引數:
GET 介面返回的每個元件格式為 { "component_id": xxx, "value": {...}, "is_deleted": false }。
傳給 update 介面時,規則如下:
component_id 和 is_deleted 欄位,去掉 value,原樣傳入{ "component_id": 新ID }(無 is_deleted){ "value": {...} } 格式傳入jump_info 欄位:GET 返回中可能包含 jump_info 頂層元件,不要將其傳入 update,跳轉資訊已包含在 main_jump_info 中node scripts/update-creative.mjs '{
"account_id": "123456789",
"dynamic_creative_id": 111222333,
"creative_components": {
"video": [{ "component_id": 1905866436402 }],
"brand": [{ "component_id": 1895897993168 }],
"description": [{ "component_id": 1895897993169 }],
"action_button": [{ "value": { "button_text": "立即諮詢", "jump_info": { "page_type": "PAGE_TYPE_WECHAT_CONSULT", "page_spec": { "wechat_consult_spec": { "page_url": "https://work.weixin.qq.com/xxx" } } } } }],
"main_jump_info": [{ "component_id": 1906127499786 }]
}
}'
返回(成功): { "success": true, "dynamic_creative_id": 111222333 }
介面詳情見: references/dynamic-creatives-update.md
序列執行:同一廣告組下創意的新建、更新、刪除不可併發。
node scripts/delete-creative.mjs '{
"account_id": "123456789",
"dynamic_creative_id": 111222333
}'
介面詳情見: references/dynamic-creatives-delete.md
素材標籤(material_labels)用於把一組圖片/影片素材聚合成"標籤包",便於素材組織與檢索。本 skill 提供 查詢 / 新建 / 更新 / 繫結 4 個標籤介面。
| 使用者意圖 | 推薦指令碼 |
|---|---|
| 查詢賬號/業務單元下的素材標籤列表(含每個標籤的素材數量) | scripts/get-material-labels.mjs |
| 批次新建素材標籤(可指定一/二級類目與業務場景) | scripts/add-material-labels.mjs |
| 修改單個標籤的名稱或一/二級類目 | scripts/update-material-labels.mjs |
把圖片/影片素材繫結到標籤上(覆蓋 / 新增 / 解除三種 binding_type) |
scripts/bind-material-labels.mjs |
呼叫示例、引數 schema、欄位約束、列舉值、錯誤碼處理詳見 references/material-labels.md。
| 介面 | 文件 | 說明 |
|---|---|---|
| dynamic_creatives/add | dynamic-creatives-add.md | 完整請求引數、列舉值 |
| dynamic_creatives/get | dynamic-creatives-get.md | 查詢創意詳情(get-creative.mjs 使用) |
| creative_components 元件詳解 | creative-components.md | 格式規則及各元件欄位說明 |
| 列舉值完整參考 | enums.md | 創意元件列舉(delivery_mode/page_type/show_data/floating_zone/label 等)+ 素材列舉(source_type/system_status/image_usage/aigc_flag 等) |
| dynamic_creatives/update | dynamic-creatives-update.md | 可更新欄位、示例 |
| dynamic_creatives/delete | dynamic-creatives-delete.md | 必填引數 |
| creative_template/get | creative-template-get.md | 查詢可用創意形式及元件配置(get-creative-templates.mjs 使用) |
| creative_template_list/get | creative-template-list-get.md | 驗證使用者指定的 creative_template_id 是否在可用列表中 |
| component_depends/get | component-depends-get.md | 查詢元件欄位聯動約束(get-component-depends.mjs 使用) |
| images/add | materials/images-add.md | 上傳圖片(upload-image.mjs 使用) |
| images/get | materials/images-get.md | 查詢圖片列表(get-images.mjs 使用) |
| videos/add | materials/videos-add.md | 上傳影片(upload-video.mjs 使用) |
| videos/get | materials/videos-get.md | 查詢影片列表(get-videos.mjs 使用) |
| integrated_list_multiaccount/get | integrated-components-get.md | 元件模式查詢素材(get-integrated-components.mjs 使用),含報表排序、起量潛力/首發/低質篩選 |
| integrated_image_list/get & integrated_media_list/get | integrated-media-get.md | 素材庫模式查詢單圖/影片(get-integrated-media.mjs 使用),含可用性過濾、報表排序 |
| muse_audios/get | materials/muse-audios-get.md | 查詢妙思版權音訊(get-audios.mjs 使用) |
| dc_review_result/get | dc-review-result-get.md | 查詢動態創意稽核詳情(get-dc-review-result.mjs 使用),返回元件/元素的稽核狀態、駁回原因、元件組合稽核資訊 |
| dynamic_ad_image_templates/get | dynamic-ad-templates.md | 查詢商品圖片模版列表(MPA/DPA,get-dynamic-ad-image-templates.mjs 使用) |
| dynamic_ad_images/add | dynamic-ad-templates.md | 從商品模版生成圖片(generate-dynamic-ad-image.mjs 使用) |
| dynamic_ad_video_templates/get | dynamic-ad-templates.md | 查詢商品影片模版列表(MPA/DPA,get-dynamic-ad-video-templates.mjs 使用) |
| dynamic_ad_video/add | dynamic-ad-templates.md | 從商品模版生成影片(generate-dynamic-ad-video.mjs 使用) |
| material_labels/get·add·update·bind | material-labels.md | 素材標籤查詢 / 新建 / 更新 / 繫結(get-material-labels / add-material-labels / update-material-labels / bind-material-labels 使用) |
adgroup_id)這個 Skill 質量不錯,文件寫得非常詳細,覆蓋了從素材上傳到創意建立、稽核查詢的完整流程。跨平臺引數傳遞的說明很貼心,各種終端環境都能照顧到。指令碼功能齊全,列舉值和元件格式都有參考文件,查起來很方便。美中不足的是指令碼數量多、結構複雜,新手初次上手可能感覺資訊量有點大,需要花時間消化。總體來說,這是一個功能完善、文件詳盡的專業 Skill,適合需要管理騰訊廣告創意的使用者使用。