Global Finalist2026 Amazon Ads Partner Awards

Developer API · Prompt library · 03 of 10

Budget pacing alert

A midday check that tells you which campaigns will run out of budget before the evening, and which are barely spending.

Key scope
RRead-only key
Build time
30 minutes
Stack
Python script on an hourly cron, alerting to Slack

For: Brands and agencies that lose evening sales to out-of-budget campaigns.

Paste this into Claude, ChatGPT or Cursor

Read https://www.sellermate.ai/api-docs first. It documents the SellerMate Public API: REST over HTTPS, X-API-Key auth, and every tool with its parameters is on that page. Every tool is POST https://api.sellermate.ai/public/v1/tools/{name} with a JSON body.

Build me a budget pacing alert that runs every hour from 9am to 6pm account-local time.

For each enabled campaign:
- Get today's spend so far with get_hourly_performance and the daily budget from list_campaigns
- Project end-of-day spend from the hours elapsed
- Flag "will run out" if projected spend is above [110]% of budget, and "underspending" if below [40]% by 2pm
- Post one Slack message listing both groups with campaign name, budget, spend so far, projection

Use get_user_context to resolve the account and its timezone. Skip the message if nothing is flagged.

Rules:
- My key is in the SELLERMATE_API_KEY environment variable. Send it as the X-API-Key header. Never hard-code it or log it.
- Call get_user_context first and use the accounts it returns. Don't invent account ids.
- Report tools are paginated (page, page_size up to 500, pagination.hasMore). Walk every page.
- On a 429, wait for the Retry-After header and retry. On a 401 or 403, stop and tell me.
- Show me the plan and the code before running anything that writes.

Stack: Python 3 with requests, Slack incoming webhook in SLACK_WEBHOOK_URL.

Fill in anything in [brackets] before you paste, or leave it and the assistant will ask. The first line sends it to the docs, where every tool is listed.

What you get

  • An hourly projection of end-of-day spend per campaign
  • Two lists, "will run out" and "underspending", with the numbers behind them
  • Silence when nothing needs attention

Before you paste

  • Read-only key.
  • Hourly data depends on the account having hourly performance synced; check it shows in SellerMate first.

Make it yours

Once it works, ask the assistant for one of these.

  • Add an --apply mode that raises budgets on flagged winners by 20% using update_campaign, within your guardrails.
  • Turn the underspending list into a dayparting proposal with create_dayparting.
Book Demo