一键导入
configure
Configure Spotify Ads API credentials via OAuth 2.0 or direct token. Sets up authentication, ad account, and execution preferences.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Configure Spotify Ads API credentials via OAuth 2.0 or direct token. Sets up authentication, ad account, and execution preferences.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
This skill should be used when the user asks to "call the Spotify Ads API", "create a Spotify ad campaign", "manage Spotify ads", "pull Spotify ad reports", "set up ad sets or ads", "upload ad assets", "target audiences on Spotify", "check campaign status", "get ad account info", "look up API schema or fields", "check what targeting options exist", or asks about Spotify advertising endpoints, request/response formats, enum values, or authentication.
Create, edit, validate, and publish draft campaigns, ad sets, and ads via the Spotify Ads API. Drafts let you build a full campaign hierarchy without going live — review and iterate before publishing. Use when the user wants to draft a campaign, validate before publishing, edit drafts, list drafts, or publish drafts.
Create a full campaign (campaign + ad sets + ads) from a plain-text description. Parses natural language into structured API calls. Prefers the draft workflow for safer creation with batch validation.
Generate Spotify Ads campaign strategy from a landing page, product or business page, brand brief, location page, uploaded creative assets, existing Spotify Ads assets, or a natural-language business goal. Use when the user asks for the best campaign structure, targeting plan, audience plan, budget split, creative rotation, API-ready campaign plan, or pre-build recommendations before creating Spotify campaigns.
Clone an existing Spotify Ads API campaign or ad set — duplicate the full hierarchy (campaign, ad sets, ads) with optional modifications to name, dates, budget, or targeting.
Manage Spotify Ads API ad sets and ads — list, create, get, or update.
| name | configure |
| description | Configure Spotify Ads API credentials via OAuth 2.0 or direct token. Sets up authentication, ad account, and execution preferences. |
| argument-hint | [oauth | manual | token <access_token>] |
| allowed-tools | ["Read","Write","Edit","Bash","AskUserQuestion"] |
Set up or update the plugin's local settings file for the active platform.
Parse the user's argument to determine the configuration mode:
oauth (default if no argument)Full OAuth 2.0 authorization flow with automatic token refresh.
Prerequisite: The user must have added http://127.0.0.1:8080/callback as a redirect URI in their app settings at developer.spotify.com. Remind the user of this before starting the flow.
Choose the active settings file:
.codex/spotify-ads-api.local.md..claude/spotify-ads-api.local.md..gemini/spotify-ads-api.local.md.
Read that file if it exists. If it does not exist, read another platform's settings file as defaults, but do not overwrite it unless the user asks.Prompt the user for OAuth credentials using AskUserQuestion:
Store the client_secret securely in the macOS Keychain:
security add-generic-password -a "spotify-ads-api" -s "spotify-ads-api-client-secret" -w "<client_secret>" -U
Do NOT write client_secret to the settings file. It must only be stored in the keychain.
<extension root>/skills/configure/, so set PLUGIN_ROOT to the extension root (two directories up from this skill's directory) instead of using the snippet below.PLUGIN_ROOT="${CODEX_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$PWD}}"
client_secret=$(security find-generic-password -a "spotify-ads-api" -s "spotify-ads-api-client-secret" -w)
python3 "${PLUGIN_ROOT}/skills/configure/scripts/oauth-flow.py" \
--client-id "<client_id>" \
--client-secret "$client_secret"
If python3 is not available, try uv run:
PLUGIN_ROOT="${CODEX_PLUGIN_ROOT:-${CLAUDE_PLUGIN_ROOT:-$PWD}}"
client_secret=$(security find-generic-password -a "spotify-ads-api" -s "spotify-ads-api-client-secret" -w)
uv run "${PLUGIN_ROOT}/skills/configure/scripts/oauth-flow.py" \
--client-id "<client_id>" \
--client-secret "$client_secret"
If Python is not available at all, fall back to the manual flow (see below).
Parse the JSON output from the script:
{"access_token": "...", "refresh_token": "...", "expires_in": 3600}
Calculate token_expires_at as the current time + expires_in seconds, formatted as ISO 8601.
Prompt for remaining settings:
GET /businesses → returns { "businesses": [...] } with each business having an id and name.GET /businesses/{business_id}/ad_accounts → returns { "ad_accounts": [...] } with each account having an id, name, and status.Write the active platform settings file (see Settings File Format below).
Read the active platform manifest for the plugin version: .codex-plugin/plugin.json on Codex, .claude-plugin/plugin.json on Claude, or gemini-extension.json (extension root) on Gemini. Set SDK_PRODUCT to codex-plugin on Codex, claude-code-plugin on Claude, or gemini-cli-extension on Gemini, then set SDK_HEADER="X-Spotify-Ads-Sdk: $SDK_PRODUCT/$PLUGIN_VERSION".
Verify with a test API call:
curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer <token>" \
-H "$SDK_HEADER" \
"https://api-partner.spotify.com/ads/v3/ad_accounts/<ad_account_id>"
manualManual OAuth flow for environments where the automated script cannot run.
Prerequisite: The user must have added http://127.0.0.1:8080/callback as a redirect URI in their app settings at developer.spotify.com. Remind the user of this before starting the flow.
Prompt for client_id and client_secret using AskUserQuestion.
Store the client_secret securely in the macOS Keychain:
security add-generic-password -a "spotify-ads-api" -s "spotify-ads-api-client-secret" -w "<client_secret>" -U
Do NOT write client_secret to the settings file.
Display the authorization URL for the user to open in their browser:
https://accounts.spotify.com/authorize?client_id=<CLIENT_ID>&response_type=code&redirect_uri=http://127.0.0.1:8080/callback
Instruct the user to:
Ask the user to paste the redirect URL, then extract the code parameter from it.
Exchange the code for tokens:
client_secret=$(security find-generic-password -a "spotify-ads-api" -s "spotify-ads-api-client-secret" -w)
curl -s -X POST "https://accounts.spotify.com/api/token" \
-H "Authorization: Basic $(echo -n '<client_id>:'"$client_secret"'' | base64)" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code&code=<CODE>&redirect_uri=http://127.0.0.1:8080/callback"
Parse the response for access_token, refresh_token, and expires_in.
Continue from step 7 of the oauth flow (calculate expiry, prompt for settings, write file, verify).
token <access_token>Legacy direct token mode for users who already have an access token.
Accept the access token from the argument.
Warn the user: "Direct token mode — this token will expire in ~1 hour with no automatic refresh. For auto-refresh, re-run the configure skill in oauth mode (/spotify-ads-api:configure oauth on Claude/Codex, /configure oauth on Gemini) using your client credentials."
Read existing settings or prompt for:
GET /businesses then GET /businesses/{business_id}/ad_accounts), or ask the user to paste it.Write the settings file with the token but without refresh credentials. Set token_expires_at to empty.
Verify with a test API call.
Write the active platform settings file in this exact format (.codex/spotify-ads-api.local.md on Codex, .claude/spotify-ads-api.local.md on Claude, .gemini/spotify-ads-api.local.md on Gemini):
---
access_token: "<token>"
refresh_token: "<refresh_token>"
token_expires_at: "<ISO 8601 timestamp>"
client_id: "<client_id>"
ad_account_id: "<uuid>"
environment: "production"
auto_execute: false
---
# Spotify Ads API Settings
Local configuration for the spotify-ads-api plugin.
Do not commit this file to version control.
Client secret is stored in the macOS Keychain, not in this file.
Note: client_secret is stored in the macOS Keychain (service: spotify-ads-api-client-secret, account: spotify-ads-api), not in this file.
For the token mode, leave refresh_token, token_expires_at, and client_id as empty strings.
Report the test API call result:
.codex/*.local.md, .claude/*.local.md, and .gemini/*.local.md..codex/, .claude/, or .gemini/) doesn't exist, create it.security find-generic-password -a "spotify-ads-api" -s "spotify-ads-api-client-secret" -w to retrieve it when needed.