A daily report cannot catch a strong campaign that stops spending at 2pm. This alert can. Every hour between 9am and 6pm, a script looks at today's spend so far, projects where each campaign will end the day, and posts two short lists to Slack. One list holds campaigns that will run out of budget before the day ends. The other holds campaigns that are barely spending.
What you need
- A Build account at build.sellermate.ai with your Amazon ad accounts connected in the console.
- A Slack channel with an incoming webhook. A webhook is a private web address that lets a script post into a channel. Slack's "Incoming Webhooks" app creates one.
- An AI assistant: Claude, ChatGPT or Cursor.
- A place to run it on a schedule: a small server, a GitHub Action or a Vercel cron job.
How the projection works
Take today's spend so far and divide it by the share of the 9am to 6pm window that has passed. At 1pm that is four hours of nine. The result is projected end-of-day spend. Compare it with the daily budget.
A campaign is at risk when projected spend is above 100% of budget, or it has already spent 90% with hours left. It is underspending when projected spend is below 50% of budget after midday. Change both thresholds as you like.
Spend is rarely even. Treat morning runs as hints and afternoon runs as warnings.
Steps
- Create a read-only API key. Open the Build console, go to API keys and create a key with read access only. Keys look like
sm_live_.... The key is shown once, so copy it now. - Store the secrets. Save the key as
BUILD_API_KEYand the Slack address asSLACK_WEBHOOK_URL. Keep them out of the script itself. - Paste the prompt below into your assistant.
- Read what it builds. It should pull today's campaign rows, find each daily budget and sort campaigns into the two lists.
- Run it in dry-run mode and check the numbers.
- Schedule it.
The prompt
Read the API docs at https://www.sellermate.ai/api-docs first.
Write a Python 3 script that checks Amazon ad budget pacing and posts
problems to Slack. It runs once per invocation.
Rules:
- Base URL is https://api.sellermate.ai/public/v1. Every tool is
POST /tools/{name} with a JSON body and an X-API-Key header.
- Read the key from BUILD_API_KEY. Never hard-code or print it.
- Call get_user_context first and use the accounts it returns. Use each
account's time zone to decide what "today" and "now" mean.
- Exit quietly outside 9:00 to 18:00 in that time zone.
- For each account, call get_campaign_performance with amazon_account_id
and start_date and end_date both set to today. Sort by spend,
descending. Use page_size and keep going while pagination.hasMore is
true.
- Find the campaign daily budget field in the docs. If the performance
rows do not include it, say which tool does and use that. Do not guess
field names.
- Projected spend = spend so far divided by the share of the 9:00 to
18:00 window that has passed.
- At risk: projected spend is above 100% of budget, or spend is already
90% or more of budget with hours left.
- Underspending: projected spend is below 50% of budget and it is after
12:00. Skip campaigns with no budget.
- Post to the webhook in SLACK_WEBHOOK_URL. One message per account with
two lists. Each line shows name, budget, spend so far and projected
spend. Post nothing if both lists are empty.
- On a 429 response, wait for the Retry-After header and retry.
- Add a --dry-run flag that prints the message instead of posting.
- Use requests only. Include a README with the cron line.
Check it
Run python pacing_alert.py --dry-run during working hours. Pick one campaign and compare its spend so far with the Build console or Seller Central. It should match, give or take the latest hour.
If it does not, the time zone is almost always the cause. Tell the assistant which time zone the account uses and run it again.
Errors to know:
401: the key is wrong or revoked.403: the key cannot see that account.429: too many requests. The limit is 60 a minute on Free and Build, and 300 on Scale. The script should wait and retry.
Run it every hour
Remove --dry-run, run the script once by hand and confirm the message lands in Slack. Then add the schedule. For every hour from 9am to 6pm, the cron line is 0 9-18 * * *.
Cron uses the time zone of the machine it runs on. A cloud server or GitHub Action is usually on UTC, so set the time zone on the schedule to match the account's. The check inside the script is a second guard. Send the channel to people who can act on it.
Make it better later
Ask the assistant to add a different threshold for each client, or ACoS beside each campaign. ACoS is ad spend divided by ad sales. It helps you decide whether a campaign that runs out early deserves more budget.
Watch out for
- Spend data lags. The latest hour is often incomplete, so early projections run low.
- Keep the key read-only. Raising a budget is a decision for a person.
- Check one account before the alert reaches a whole client list.