Every Monday, one Slack message per account. It shows last week's spend, sales, ACoS and orders next to the week before, names the three campaigns that moved most, and ends with one plain sentence you can forward to the client. ACoS is ad spend divided by ad sales.
You do not write the script. Claude, ChatGPT or Cursor writes it from the prompt below. You supply a key, a Slack link and a schedule.
What you need
- A Build account at build.sellermate.ai with the client 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 the script on a schedule. A laptop is fine for testing. For real use, pick a small server, a GitHub Action or a Vercel cron job.
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. A read-only key cannot change anything, which is all a report needs. - 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 do three things. It lists your accounts. It pulls two weekly totals for each account. It pulls campaign rows for both weeks and ranks the changes.
- Run it in dry-run mode and check the numbers (next section).
- Schedule it.
The prompt
Read the API docs at https://www.sellermate.ai/api-docs first.
Write a Python 3 script that posts a weekly Amazon ads report to Slack,
one message per account.
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.
- For each account, call get_marketplace_summary for the last 7 full days
and for the 7 days before. Show spend, sales, ACoS and orders, with
percent change.
- Call get_campaign_performance for both weeks, sorted by spend. Match
campaigns by name and show the three with the biggest change in spend
or ACoS.
- Report tools are paginated. Use page_size and keep going while
pagination.hasMore is true.
- On a 429 response, wait for the Retry-After header and retry.
- End each message with one plain sentence for the client.
- Post to the webhook in SLACK_WEBHOOK_URL. Add a --dry-run flag that
prints the message instead of posting.
- Use requests only. Include a README with the cron line for Mondays
at 8:00 and the exact week boundaries you used.
Check it
Run python weekly_report.py --dry-run. Pick one account and open the same dates in the Build console or in Seller Central. The totals should match.
If they do not, the date range is almost always the cause. Tell the assistant the exact seven days and which time zone to use, then run it again.
A few other messages mean something specific:
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 week
Remove --dry-run, run the script once by hand, and confirm the message lands in Slack. Then add the schedule. For 8:00 every Monday the cron line is 0 8 * * 1. Check the README the assistant wrote and make sure the time zone is the one you want.
Make it better later
Ask the assistant to add any of these once the base report works:
- A separate channel for each client.
- TACoS, which is ad spend divided by total sales, using
get_retail_product_performance. This needs a Seller Central connection. - The top three search terms by spend, using
get_search_term_performance.
Watch out for
- Recent days move. Amazon keeps adding sales to a click for several days, so last week's numbers can shift a little when you re-run them. Report on complete weeks.
- Keep the key read-only. This script never needs to write.
- Check the numbers for one client before you let the report reach all of them.
- Retention depends on your plan: 90 days on Free, 12 months on Build, 3 years on Scale. Comparisons only work inside that window.