insightfulpipe 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SKILL.md CHANGED
@@ -1,8 +1,25 @@
1
1
  ---
2
2
  name: insightfulpipe
3
- description: Query and manage marketing data across 40+ platforms — Google Analytics, Google Ads, Facebook Ads, Instagram, Shopify, HubSpot, Klaviyo, TikTok, LinkedIn, and more.
3
+ description: "Query and manage marketing data across 40+ platforms — Google Analytics, Google Ads, Facebook Ads, Instagram, Shopify, HubSpot, Klaviyo, TikTok, LinkedIn, and more."
4
4
  homepage: https://insightfulpipe.com
5
- metadata: {"clawdbot":{"emoji":"📊","requires":{"bins":[],"env":["INSIGHTFULPIPE_TOKEN"]}}}
5
+ metadata:
6
+ {
7
+ "openclaw":
8
+ {
9
+ "emoji": "📊",
10
+ "requires": { "bins": ["insightfulpipe"], "env": ["INSIGHTFULPIPE_TOKEN"] },
11
+ "install":
12
+ [
13
+ {
14
+ "id": "node",
15
+ "kind": "node",
16
+ "package": "insightfulpipe",
17
+ "bins": ["insightfulpipe"],
18
+ "label": "Install InsightfulPipe CLI (npm)",
19
+ },
20
+ ],
21
+ },
22
+ }
6
23
  ---
7
24
 
8
25
  ## Install InsightfulPipe if it doesn't exist
@@ -23,49 +40,282 @@ npm release: https://www.npmjs.com/package/insightfulpipe
23
40
 
24
41
  ---
25
42
 
43
+ ## Important: Authentication
44
+
45
+ The `INSIGHTFULPIPE_TOKEN` environment variable should already be configured. Do NOT ask the user to set it or export it. Just run commands directly. If a command fails with "Invalid token" or "Not authenticated", then tell the user their token is not configured.
46
+
47
+ ---
48
+
26
49
  ## Core Workflow
27
50
 
28
- 1. **Authenticate**Set your API token
29
- 2. **Discover** — List platforms and available actions
30
- 3. **Schema** — Get the exact request body for an action
31
- 4. **Query** — Execute read operations (reports, analytics, listings)
32
- 5. **Execute** — Execute write operations (create, update, delete, publish)
51
+ Every query follows: discover → schema → execute. Run commands directly do not ask the user for permission to run each one.
33
52
 
34
53
  ```bash
35
- # 1. Authenticate
36
- export INSIGHTFULPIPE_TOKEN=ip_sk_your_token
37
- # or
38
- insightfulpipe auth
39
-
40
- # 2. Discover
41
- insightfulpipe platforms
54
+ # 1. Get account IDs (workspace_id, brand_id, source IDs)
42
55
  insightfulpipe accounts --platform <platform> --json
56
+
57
+ # 2. See available actions
43
58
  insightfulpipe helper <platform>
44
59
 
45
- # 3. Schema
60
+ # 3. Get request body schema for specific actions
46
61
  insightfulpipe helper <platform> --actions <action1>,<action2>
47
62
 
48
- # 4. Query (read)
49
- insightfulpipe query <platform> -b '{"action":"...","workspace_id":...,"brand_id":...}'
63
+ # 4. Execute read query
64
+ insightfulpipe query <platform> -b '{"action":"<action>","workspace_id":<id>,"brand_id":<id>,...}'
65
+
66
+ # 5. Execute write operation (requires --yes)
67
+ insightfulpipe action <platform> -b '{"action":"<action>",...}' --yes
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Platform Examples
73
+
74
+ ### Google Analytics — Top Pages
75
+
76
+ ```bash
77
+ insightfulpipe accounts --platform google-analytics --json
78
+ insightfulpipe helper google-analytics --actions pages
79
+ insightfulpipe query google-analytics -b '{
80
+ "action": "pages",
81
+ "workspace_id": xxx,
82
+ "brand_id": xxx,
83
+ "property_id": "properties/xxx",
84
+ "dimensions": ["pagePath"],
85
+ "metrics": ["screenPageViews", "activeUsers"],
86
+ "start_date": "2026-03-01",
87
+ "end_date": "2026-03-20",
88
+ "limit": 10
89
+ }'
90
+ ```
91
+
92
+ ### Google Analytics — Traffic Sources
93
+
94
+ ```bash
95
+ insightfulpipe query google-analytics -b '{
96
+ "action": "traffic_sources",
97
+ "workspace_id": xxx,
98
+ "brand_id": xxx,
99
+ "property_id": "properties/xxx",
100
+ "dimensions": ["sessionSource", "sessionMedium"],
101
+ "metrics": ["sessions", "totalUsers", "bounceRate"],
102
+ "start_date": "2026-03-01",
103
+ "end_date": "2026-03-20"
104
+ }'
105
+ ```
106
+
107
+ ### Google Analytics — Freeform Report
108
+
109
+ ```bash
110
+ insightfulpipe query google-analytics -b '{
111
+ "action": "get_report",
112
+ "workspace_id": xxx,
113
+ "brand_id": xxx,
114
+ "property_id": "properties/xxx",
115
+ "dimensions": ["date", "country"],
116
+ "metrics": ["activeUsers", "sessions"],
117
+ "start_date": "2026-03-01",
118
+ "end_date": "2026-03-20"
119
+ }'
120
+ ```
121
+
122
+ ### Google Search Console — Top Queries
123
+
124
+ ```bash
125
+ insightfulpipe query google-search-console -b '{
126
+ "action": "search_analytics",
127
+ "workspace_id": xxx,
128
+ "brand_id": xxx,
129
+ "site_url": "https://example.com/",
130
+ "dimensions": ["query"],
131
+ "start_date": "2026-03-01",
132
+ "end_date": "2026-03-20",
133
+ "row_limit": 10
134
+ }'
135
+ ```
136
+
137
+ ### Google Search Console — Pages by Country
138
+
139
+ ```bash
140
+ insightfulpipe query google-search-console -b '{
141
+ "action": "search_analytics",
142
+ "workspace_id": xxx,
143
+ "brand_id": xxx,
144
+ "site_url": "https://example.com/",
145
+ "dimensions": ["page", "country"],
146
+ "start_date": "2026-03-01",
147
+ "end_date": "2026-03-20",
148
+ "row_limit": 20
149
+ }'
150
+ ```
151
+
152
+ ### Google Sheets — Peek at Columns Then Query
153
+
154
+ ```bash
155
+ # First peek to see column names
156
+ insightfulpipe query google-sheets -b '{
157
+ "action": "get_sheet_peak",
158
+ "workspace_id": xxx,
159
+ "brand_id": xxx,
160
+ "spreadsheet_id": "xxx",
161
+ "sheet_id": "0"
162
+ }'
163
+
164
+ # Then query with filters using exact column names from peek
165
+ insightfulpipe query google-sheets -b '{
166
+ "action": "query_sheet_data",
167
+ "workspace_id": xxx,
168
+ "brand_id": xxx,
169
+ "spreadsheet_id": "xxx",
170
+ "sheet_id": "0",
171
+ "select": "Name,Email,Status",
172
+ "where": "Status=Active",
173
+ "limit": 50
174
+ }'
175
+ ```
176
+
177
+ ### Google Sheets — Write Cells
178
+
179
+ ```bash
180
+ insightfulpipe action google-sheets -b '{
181
+ "action": "update_cells",
182
+ "workspace_id": xxx,
183
+ "brand_id": xxx,
184
+ "spreadsheet_id": "xxx",
185
+ "sheet_id": "0",
186
+ "range": "A1:C2",
187
+ "values": [["Name", "Email", "Status"], ["John", "john@example.com", "Active"]]
188
+ }' --yes
189
+ ```
190
+
191
+ ### Shopify — Recent Orders
192
+
193
+ ```bash
194
+ insightfulpipe query shopify -b '{
195
+ "action": "get_orders",
196
+ "workspace_id": xxx,
197
+ "brand_id": xxx,
198
+ "status": "any",
199
+ "limit": 10
200
+ }'
201
+ ```
202
+
203
+ ### Shopify — Products
204
+
205
+ ```bash
206
+ insightfulpipe query shopify -b '{
207
+ "action": "get_products",
208
+ "workspace_id": xxx,
209
+ "brand_id": xxx,
210
+ "limit": 10
211
+ }'
212
+ ```
213
+
214
+ ### Any Other Platform
215
+
216
+ ```bash
217
+ # Same pattern works for all platforms:
218
+ insightfulpipe helper <platform> # See actions
219
+ insightfulpipe helper <platform> --actions <action> # Get body schema
220
+ insightfulpipe query <platform> -b '{...}' # Execute
221
+ ```
222
+
223
+ Supported platforms include: facebook-ads, instagram, tiktok-ads, tiktok-pages, linkedin-ads, linkedin-pages, hubspot, klaviyo, mailchimp, stripe, slack, telegram, and many more. Run `insightfulpipe platforms` to see the full list.
224
+
225
+ ---
226
+
227
+ ## Common Patterns
228
+
229
+ ### Pattern 1: Pipe to jq
230
+
231
+ ```bash
232
+ # Extract just page paths from GA response
233
+ insightfulpipe query google-analytics -b '{...}' | jq '.data[].pagePath'
234
+
235
+ # Get total sessions
236
+ insightfulpipe query google-analytics -b '{...}' | jq '[.data[].sessions] | add'
237
+ ```
238
+
239
+ ### Pattern 2: Compare Data Across Platforms
240
+
241
+ ```bash
242
+ # GA traffic
243
+ GA=$(insightfulpipe query google-analytics -b '{
244
+ "action": "traffic_sources", "workspace_id": xxx, "brand_id": xxx,
245
+ "property_id": "properties/xxx",
246
+ "dimensions": ["sessionSource"], "metrics": ["sessions"],
247
+ "start_date": "2026-03-01", "end_date": "2026-03-20"
248
+ }')
249
+
250
+ # GSC queries
251
+ GSC=$(insightfulpipe query google-search-console -b '{
252
+ "action": "search_analytics", "workspace_id": xxx, "brand_id": xxx,
253
+ "site_url": "https://example.com/",
254
+ "dimensions": ["query"],
255
+ "start_date": "2026-03-01", "end_date": "2026-03-20", "row_limit": 10
256
+ }')
257
+
258
+ echo "$GA" | jq '.data[:5]'
259
+ echo "$GSC" | jq '.data[:5]'
260
+ ```
261
+
262
+ ### Pattern 3: Write Operations
263
+
264
+ ```bash
265
+ # Always use "action" (not "query") and --yes for writes
266
+ insightfulpipe action google-sheets -b '{
267
+ "action": "create_sheet",
268
+ "workspace_id": xxx,
269
+ "brand_id": xxx,
270
+ "spreadsheet_id": "xxx",
271
+ "title": "New Sheet"
272
+ }' --yes
273
+ ```
274
+
275
+ ### Pattern 4: Use Prompts for Guided Analysis
50
276
 
51
- # 5. Execute (write)
52
- insightfulpipe action <platform> -b '{"action":"..."}' --yes
277
+ ```bash
278
+ insightfulpipe prompts google-analytics # List templates
279
+ insightfulpipe prompts google-analytics --id 12 # Get specific prompt
53
280
  ```
54
281
 
55
- ## Key Rules
282
+ ---
283
+
284
+ ## Gotchas
56
285
 
57
- - **Never guess the request body** — always call `helper <platform> --actions <action>` first to get the exact schema.
58
- - **Replace "xxx" placeholders** with real values from `accounts --platform <platform> --json`.
59
- - **Use `query`** for read operations (reports, analytics, metrics, listings).
60
- - **Use `action`** for write operations (create, update, delete, publish, send). Requires `--yes` in non-interactive mode.
286
+ 1. **Never guess the request body** — always run `helper <platform> --actions <action>` first.
287
+ 2. **Replace ALL "xxx" placeholders** get real values from `accounts --platform <platform> --json`.
288
+ 3. **GA property_id needs "properties/" prefix** use `"properties/510157516"` not `"510157516"`.
289
+ 4. **Date format is YYYY-MM-DD** use `"2026-03-20"` not `"2026-03-20T00:00:00Z"`.
290
+ 5. **Use `query` for reads, `action --yes` for writes** — using the wrong one will fail.
291
+ 6. **Google Sheets: peek before query** — call `get_sheet_peak` first to see column names.
292
+ 7. **Different platforms have different source IDs** — GA uses `property_id`, GSC uses `site_url`, Shopify uses `shop_domain`, Facebook Ads uses `ad_account_id`.
293
+ 8. **Empty data is not an error** — `{"status":"success","data":[]}` means no data matched your filters.
294
+ 9. **Do not ask the user to export the token** — it should already be set. If auth fails, tell the user to check their token configuration.
61
295
 
62
- ## Other Commands
296
+ ---
297
+
298
+ ## All Commands
63
299
 
64
300
  ```bash
65
- insightfulpipe platforms # All supported platforms
66
- insightfulpipe sources --platform X # Connected sources with IDs
67
- insightfulpipe prompts <platform> # Prompt templates
68
- insightfulpipe brands --workspace ID # Brand metadata
69
- insightfulpipe whoami # Current user
70
- insightfulpipe doctor # Check auth and connectivity
301
+ # Discovery
302
+ insightfulpipe platforms # All supported platforms
303
+ insightfulpipe accounts --platform <platform> --json # Account IDs
304
+ insightfulpipe sources --platform <platform> # Sources with IDs
305
+ insightfulpipe brands --workspace <id> # Brand metadata
306
+ insightfulpipe whoami # Current user
307
+ insightfulpipe doctor # Check auth
308
+
309
+ # Schema
310
+ insightfulpipe helper <platform> # List actions
311
+ insightfulpipe helper <platform> --actions <a1>,<a2> # Body schema
312
+
313
+ # Execute
314
+ insightfulpipe query <platform> -b '<json>' # Read data
315
+ insightfulpipe query <platform> -f file.json # Read from file
316
+ insightfulpipe action <platform> -b '<json>' --yes # Write data
317
+
318
+ # Prompts
319
+ insightfulpipe prompts <platform> # List templates
320
+ insightfulpipe prompts <platform> --id <id> # Get prompt
71
321
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "insightfulpipe",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "InsightfulPipe CLI — query your marketing data from the terminal",
5
5
  "bin": {
6
6
  "insightfulpipe": "bin/cli.js"
@@ -7,6 +7,7 @@ import { fileURLToPath } from 'url';
7
7
  // Auto-detect skills directory: env var > known OpenClaw paths
8
8
  const KNOWN_PATHS = [
9
9
  process.env.OPENCLAW_SKILLS_DIR,
10
+ '/data/workspace/skills',
10
11
  '/openclaw/skills',
11
12
  join(process.env.HOME || '', '.openclaw', 'skills'),
12
13
  ];
@@ -1,8 +1,25 @@
1
1
  ---
2
2
  name: insightfulpipe
3
- description: Query and manage marketing data across 40+ platforms — Google Analytics, Google Ads, Facebook Ads, Instagram, Shopify, HubSpot, Klaviyo, TikTok, LinkedIn, and more.
3
+ description: "Query and manage marketing data across 40+ platforms — Google Analytics, Google Ads, Facebook Ads, Instagram, Shopify, HubSpot, Klaviyo, TikTok, LinkedIn, and more."
4
4
  homepage: https://insightfulpipe.com
5
- metadata: {"clawdbot":{"emoji":"📊","requires":{"bins":[],"env":["INSIGHTFULPIPE_TOKEN"]}}}
5
+ metadata:
6
+ {
7
+ "openclaw":
8
+ {
9
+ "emoji": "📊",
10
+ "requires": { "bins": ["insightfulpipe"], "env": ["INSIGHTFULPIPE_TOKEN"] },
11
+ "install":
12
+ [
13
+ {
14
+ "id": "node",
15
+ "kind": "node",
16
+ "package": "insightfulpipe",
17
+ "bins": ["insightfulpipe"],
18
+ "label": "Install InsightfulPipe CLI (npm)",
19
+ },
20
+ ],
21
+ },
22
+ }
6
23
  ---
7
24
 
8
25
  ## Install InsightfulPipe if it doesn't exist
@@ -23,49 +40,282 @@ npm release: https://www.npmjs.com/package/insightfulpipe
23
40
 
24
41
  ---
25
42
 
43
+ ## Important: Authentication
44
+
45
+ The `INSIGHTFULPIPE_TOKEN` environment variable should already be configured. Do NOT ask the user to set it or export it. Just run commands directly. If a command fails with "Invalid token" or "Not authenticated", then tell the user their token is not configured.
46
+
47
+ ---
48
+
26
49
  ## Core Workflow
27
50
 
28
- 1. **Authenticate**Set your API token
29
- 2. **Discover** — List platforms and available actions
30
- 3. **Schema** — Get the exact request body for an action
31
- 4. **Query** — Execute read operations (reports, analytics, listings)
32
- 5. **Execute** — Execute write operations (create, update, delete, publish)
51
+ Every query follows: discover → schema → execute. Run commands directly do not ask the user for permission to run each one.
33
52
 
34
53
  ```bash
35
- # 1. Authenticate
36
- export INSIGHTFULPIPE_TOKEN=ip_sk_your_token
37
- # or
38
- insightfulpipe auth
39
-
40
- # 2. Discover
41
- insightfulpipe platforms
54
+ # 1. Get account IDs (workspace_id, brand_id, source IDs)
42
55
  insightfulpipe accounts --platform <platform> --json
56
+
57
+ # 2. See available actions
43
58
  insightfulpipe helper <platform>
44
59
 
45
- # 3. Schema
60
+ # 3. Get request body schema for specific actions
46
61
  insightfulpipe helper <platform> --actions <action1>,<action2>
47
62
 
48
- # 4. Query (read)
49
- insightfulpipe query <platform> -b '{"action":"...","workspace_id":...,"brand_id":...}'
63
+ # 4. Execute read query
64
+ insightfulpipe query <platform> -b '{"action":"<action>","workspace_id":<id>,"brand_id":<id>,...}'
65
+
66
+ # 5. Execute write operation (requires --yes)
67
+ insightfulpipe action <platform> -b '{"action":"<action>",...}' --yes
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Platform Examples
73
+
74
+ ### Google Analytics — Top Pages
75
+
76
+ ```bash
77
+ insightfulpipe accounts --platform google-analytics --json
78
+ insightfulpipe helper google-analytics --actions pages
79
+ insightfulpipe query google-analytics -b '{
80
+ "action": "pages",
81
+ "workspace_id": xxx,
82
+ "brand_id": xxx,
83
+ "property_id": "properties/xxx",
84
+ "dimensions": ["pagePath"],
85
+ "metrics": ["screenPageViews", "activeUsers"],
86
+ "start_date": "2026-03-01",
87
+ "end_date": "2026-03-20",
88
+ "limit": 10
89
+ }'
90
+ ```
91
+
92
+ ### Google Analytics — Traffic Sources
93
+
94
+ ```bash
95
+ insightfulpipe query google-analytics -b '{
96
+ "action": "traffic_sources",
97
+ "workspace_id": xxx,
98
+ "brand_id": xxx,
99
+ "property_id": "properties/xxx",
100
+ "dimensions": ["sessionSource", "sessionMedium"],
101
+ "metrics": ["sessions", "totalUsers", "bounceRate"],
102
+ "start_date": "2026-03-01",
103
+ "end_date": "2026-03-20"
104
+ }'
105
+ ```
106
+
107
+ ### Google Analytics — Freeform Report
108
+
109
+ ```bash
110
+ insightfulpipe query google-analytics -b '{
111
+ "action": "get_report",
112
+ "workspace_id": xxx,
113
+ "brand_id": xxx,
114
+ "property_id": "properties/xxx",
115
+ "dimensions": ["date", "country"],
116
+ "metrics": ["activeUsers", "sessions"],
117
+ "start_date": "2026-03-01",
118
+ "end_date": "2026-03-20"
119
+ }'
120
+ ```
121
+
122
+ ### Google Search Console — Top Queries
123
+
124
+ ```bash
125
+ insightfulpipe query google-search-console -b '{
126
+ "action": "search_analytics",
127
+ "workspace_id": xxx,
128
+ "brand_id": xxx,
129
+ "site_url": "https://example.com/",
130
+ "dimensions": ["query"],
131
+ "start_date": "2026-03-01",
132
+ "end_date": "2026-03-20",
133
+ "row_limit": 10
134
+ }'
135
+ ```
136
+
137
+ ### Google Search Console — Pages by Country
138
+
139
+ ```bash
140
+ insightfulpipe query google-search-console -b '{
141
+ "action": "search_analytics",
142
+ "workspace_id": xxx,
143
+ "brand_id": xxx,
144
+ "site_url": "https://example.com/",
145
+ "dimensions": ["page", "country"],
146
+ "start_date": "2026-03-01",
147
+ "end_date": "2026-03-20",
148
+ "row_limit": 20
149
+ }'
150
+ ```
151
+
152
+ ### Google Sheets — Peek at Columns Then Query
153
+
154
+ ```bash
155
+ # First peek to see column names
156
+ insightfulpipe query google-sheets -b '{
157
+ "action": "get_sheet_peak",
158
+ "workspace_id": xxx,
159
+ "brand_id": xxx,
160
+ "spreadsheet_id": "xxx",
161
+ "sheet_id": "0"
162
+ }'
163
+
164
+ # Then query with filters using exact column names from peek
165
+ insightfulpipe query google-sheets -b '{
166
+ "action": "query_sheet_data",
167
+ "workspace_id": xxx,
168
+ "brand_id": xxx,
169
+ "spreadsheet_id": "xxx",
170
+ "sheet_id": "0",
171
+ "select": "Name,Email,Status",
172
+ "where": "Status=Active",
173
+ "limit": 50
174
+ }'
175
+ ```
176
+
177
+ ### Google Sheets — Write Cells
178
+
179
+ ```bash
180
+ insightfulpipe action google-sheets -b '{
181
+ "action": "update_cells",
182
+ "workspace_id": xxx,
183
+ "brand_id": xxx,
184
+ "spreadsheet_id": "xxx",
185
+ "sheet_id": "0",
186
+ "range": "A1:C2",
187
+ "values": [["Name", "Email", "Status"], ["John", "john@example.com", "Active"]]
188
+ }' --yes
189
+ ```
190
+
191
+ ### Shopify — Recent Orders
192
+
193
+ ```bash
194
+ insightfulpipe query shopify -b '{
195
+ "action": "get_orders",
196
+ "workspace_id": xxx,
197
+ "brand_id": xxx,
198
+ "status": "any",
199
+ "limit": 10
200
+ }'
201
+ ```
202
+
203
+ ### Shopify — Products
204
+
205
+ ```bash
206
+ insightfulpipe query shopify -b '{
207
+ "action": "get_products",
208
+ "workspace_id": xxx,
209
+ "brand_id": xxx,
210
+ "limit": 10
211
+ }'
212
+ ```
213
+
214
+ ### Any Other Platform
215
+
216
+ ```bash
217
+ # Same pattern works for all platforms:
218
+ insightfulpipe helper <platform> # See actions
219
+ insightfulpipe helper <platform> --actions <action> # Get body schema
220
+ insightfulpipe query <platform> -b '{...}' # Execute
221
+ ```
222
+
223
+ Supported platforms include: facebook-ads, instagram, tiktok-ads, tiktok-pages, linkedin-ads, linkedin-pages, hubspot, klaviyo, mailchimp, stripe, slack, telegram, and many more. Run `insightfulpipe platforms` to see the full list.
224
+
225
+ ---
226
+
227
+ ## Common Patterns
228
+
229
+ ### Pattern 1: Pipe to jq
230
+
231
+ ```bash
232
+ # Extract just page paths from GA response
233
+ insightfulpipe query google-analytics -b '{...}' | jq '.data[].pagePath'
234
+
235
+ # Get total sessions
236
+ insightfulpipe query google-analytics -b '{...}' | jq '[.data[].sessions] | add'
237
+ ```
238
+
239
+ ### Pattern 2: Compare Data Across Platforms
240
+
241
+ ```bash
242
+ # GA traffic
243
+ GA=$(insightfulpipe query google-analytics -b '{
244
+ "action": "traffic_sources", "workspace_id": xxx, "brand_id": xxx,
245
+ "property_id": "properties/xxx",
246
+ "dimensions": ["sessionSource"], "metrics": ["sessions"],
247
+ "start_date": "2026-03-01", "end_date": "2026-03-20"
248
+ }')
249
+
250
+ # GSC queries
251
+ GSC=$(insightfulpipe query google-search-console -b '{
252
+ "action": "search_analytics", "workspace_id": xxx, "brand_id": xxx,
253
+ "site_url": "https://example.com/",
254
+ "dimensions": ["query"],
255
+ "start_date": "2026-03-01", "end_date": "2026-03-20", "row_limit": 10
256
+ }')
257
+
258
+ echo "$GA" | jq '.data[:5]'
259
+ echo "$GSC" | jq '.data[:5]'
260
+ ```
261
+
262
+ ### Pattern 3: Write Operations
263
+
264
+ ```bash
265
+ # Always use "action" (not "query") and --yes for writes
266
+ insightfulpipe action google-sheets -b '{
267
+ "action": "create_sheet",
268
+ "workspace_id": xxx,
269
+ "brand_id": xxx,
270
+ "spreadsheet_id": "xxx",
271
+ "title": "New Sheet"
272
+ }' --yes
273
+ ```
274
+
275
+ ### Pattern 4: Use Prompts for Guided Analysis
50
276
 
51
- # 5. Execute (write)
52
- insightfulpipe action <platform> -b '{"action":"..."}' --yes
277
+ ```bash
278
+ insightfulpipe prompts google-analytics # List templates
279
+ insightfulpipe prompts google-analytics --id 12 # Get specific prompt
53
280
  ```
54
281
 
55
- ## Key Rules
282
+ ---
283
+
284
+ ## Gotchas
56
285
 
57
- - **Never guess the request body** — always call `helper <platform> --actions <action>` first to get the exact schema.
58
- - **Replace "xxx" placeholders** with real values from `accounts --platform <platform> --json`.
59
- - **Use `query`** for read operations (reports, analytics, metrics, listings).
60
- - **Use `action`** for write operations (create, update, delete, publish, send). Requires `--yes` in non-interactive mode.
286
+ 1. **Never guess the request body** — always run `helper <platform> --actions <action>` first.
287
+ 2. **Replace ALL "xxx" placeholders** get real values from `accounts --platform <platform> --json`.
288
+ 3. **GA property_id needs "properties/" prefix** use `"properties/510157516"` not `"510157516"`.
289
+ 4. **Date format is YYYY-MM-DD** use `"2026-03-20"` not `"2026-03-20T00:00:00Z"`.
290
+ 5. **Use `query` for reads, `action --yes` for writes** — using the wrong one will fail.
291
+ 6. **Google Sheets: peek before query** — call `get_sheet_peak` first to see column names.
292
+ 7. **Different platforms have different source IDs** — GA uses `property_id`, GSC uses `site_url`, Shopify uses `shop_domain`, Facebook Ads uses `ad_account_id`.
293
+ 8. **Empty data is not an error** — `{"status":"success","data":[]}` means no data matched your filters.
294
+ 9. **Do not ask the user to export the token** — it should already be set. If auth fails, tell the user to check their token configuration.
61
295
 
62
- ## Other Commands
296
+ ---
297
+
298
+ ## All Commands
63
299
 
64
300
  ```bash
65
- insightfulpipe platforms # All supported platforms
66
- insightfulpipe sources --platform X # Connected sources with IDs
67
- insightfulpipe prompts <platform> # Prompt templates
68
- insightfulpipe brands --workspace ID # Brand metadata
69
- insightfulpipe whoami # Current user
70
- insightfulpipe doctor # Check auth and connectivity
301
+ # Discovery
302
+ insightfulpipe platforms # All supported platforms
303
+ insightfulpipe accounts --platform <platform> --json # Account IDs
304
+ insightfulpipe sources --platform <platform> # Sources with IDs
305
+ insightfulpipe brands --workspace <id> # Brand metadata
306
+ insightfulpipe whoami # Current user
307
+ insightfulpipe doctor # Check auth
308
+
309
+ # Schema
310
+ insightfulpipe helper <platform> # List actions
311
+ insightfulpipe helper <platform> --actions <a1>,<a2> # Body schema
312
+
313
+ # Execute
314
+ insightfulpipe query <platform> -b '<json>' # Read data
315
+ insightfulpipe query <platform> -f file.json # Read from file
316
+ insightfulpipe action <platform> -b '<json>' --yes # Write data
317
+
318
+ # Prompts
319
+ insightfulpipe prompts <platform> # List templates
320
+ insightfulpipe prompts <platform> --id <id> # Get prompt
71
321
  ```