Spend digests and CPA alerts in n8n, Make and Zapier
Two recipes on the Valkiria REST API v1, for the ad accounts you connected in Valkiria: a daily spend digest and an alert when the cost per conversion goes up. Both only read; the last step posts to Slack and can be swapped for email.
01
Get a key and try the call
- Sign in to Valkiria and open Developer API keys.
- Create a key with the single scope analytics:read. It starts with vk_live_ and is shown once.
- Run the call below. Every recipe sends the key the same way, as a Bearer header.
- The key reads analytics only. It cannot change a campaign or a budget.
curl -H "Authorization: Bearer vk_live_..." "https://valkiria.pro/api/v1/analytics/spend?period=7d&group_by=day"02
Recipes
Import the file into your tool, select the key and your Slack webhook, run once, then switch it on.
| n8n | Make | Zapier | Source | |
|---|---|---|---|---|
| Daily spend digest | Import file: daily-spend-digest.json | Import Blueprint: daily-spend-digest.blueprint.json | Schedule, Webhooks GET, Slack (step list) | |
| Alert when CPA rises | Import file: cpa-rise-alert.json | Import Blueprint: cpa-rise-alert.blueprint.json | Schedule, Code by Zapier (cpa-rise-alert.js), Filter, Slack |
03
Download
04
Endpoints the recipes call
- GET /api/v1/analytics/spend: period 7d, 14d, 30d, 60d or 90d; group_by day, week or month. Returns totalSpend and currency, byCurrency, and a timeline with spend per period.
- GET /api/v1/analytics/conversions: period as above, optional platform. Returns avgCPA and currency, byCurrency with spend, conversions and CPA, and the campaigns behind them.
- Amounts are in whole currency units. Different currencies are not added up: with more than one, totalSpend and avgCPA are null and the numbers are per currency in byCurrency.
- A metric the ad platform did not report is null, not zero.
05
How the CPA alert decides
- It reads the conversion report for the last 7 days and for the last 30 days.
- Per currency, it divides the 7-day CPA by the 30-day CPA and sends a message at 1.3 or more. The ratio is one value at the top of the n8n code step, the Zapier code step and the Make filter.
- No message is sent when CPA is flat or down, or when a period has no conversions.
06
The same check inside Valkiria
Valkiria monitors run this kind of check without an outside tool: the cpa_guard monitor compares the CPA of each campaign with the median CPA of the account and, in notify mode, sends an in-app notification (in propose mode it can queue a budget proposal for approval instead), and an AI assistant can create one with monitor_create. The recipes on this page are for teams that want the message in Slack, email or their own workflow.
07
FAQ
Create a key and import the first recipe
Create a free account, connect an ad account and issue a read-only analytics key.