Developer documentation

Aopy for Claude and ChatGPT

Connect your Aopy account to Claude or ChatGPT and ask about campaigns, segments, revenue and orders, or create drafts. The connector address is https://app.aopy.com/api/mcp. The tool list below is generated from the connector's own definitions. How it works, in plain words: Aopy for Claude and ChatGPT.

Connect

In Claude

  1. Open Settings → Connectors in Claude.
  2. Choose Add custom connector and paste the connector address.
  3. Sign in with your Aopy account and choose the organization.
  4. Approve access and ask Claude for a report on your campaigns.

In ChatGPT

  1. Turn on Developer mode in the ChatGPT settings.
  2. Choose Create connector and paste the same address.
  3. Sign in with your Aopy account, choose the organization and approve.
  4. Start a new chat with the Aopy connector turned on.

Permissions

You choose the permissions on the Aopy consent screen when you connect: read is always on, write and send stay off until you tick them, and send includes write. Each tool needs one of them. To change them, connect again.

Safety and limits

Tools (43)

Read tools (25)

Look things up. Nothing in your account changes.

get_planning_context

Readaopy.read

Planning context

Everything needed to plan the next sends in one call: what is scheduled in the next horizon_days (default 14) and the drafts, how the last 28 days went (open, click and unsubscribe rates, revenue, top 5 campaigns), which core automations are missing or paused, customer groups at risk, 7-day delivery health, emails left on the plan and upcoming Romanian/EU shopping dates. Days are in the account time zone (time_zone). Use it for "what should I send". suggestions_inputs are facts, not advice. Next: get_best_send_time, rank_segments, analyze_products, create_campaign_draft.

ParameterTypeMeaning
horizon_daysinteger · >= 7 · <= 45Days ahead to plan, 7 to 45. Default 14.

get_account_overview

Readaopy.read

Account overview

A snapshot of the Aopy account: organization name, currency, time zone, language, plan and subscription status, usage against plan limits (contacts, emails this month and emails left, automations), sending domains and whether sending is paused, the email attribution windows, and connected stores with their sync status (at most 100). Call first in a new conversation: currency, time zone, language and attribution windows are facts you must not guess. Sections your role cannot read are listed in unavailable_sections. Next: get_planning_context.

No parameters.

list_campaigns

Readaopy.read

List campaigns

Lists the organization's campaigns, newest activity first, with status, schedule, audience, open and click rates and revenue (cents plus a formatted string, in the organization's currency). Read-only. At most 100 per call (default 25); when has_more is true, pass next_cursor as cursor for the next page. A draft or scheduled campaign edited while you page moves to the top and can be missed; if campaigns were edited meanwhile, restart from the first page. For the results of one campaign call get_campaign_report; to rank or compare many campaigns call analyze_campaigns.

ParameterTypeMeaning
statusstring · draft | scheduled | sending | sent | paused | cancelledOnly campaigns in this status.
searchstring · min 1 chars · max 100 charsCase-insensitive text to look for in the campaign name or subject.
limitinteger · >= 1 · <= 100How many campaigns to return, 1 to 100. Default 25.
cursorstring · min 1 chars · max 500 charsPaste next_cursor from the previous call to read the next page; leave it out for the first page.

get_campaign

Readaopy.read

Get a campaign

Returns one campaign's settings (name, subject, sender, status, schedule), its audience (segment and lists), a readable summary of the email (visible text, links, product ids, images, whether an unsubscribe link is present) and, for an A/B test, its variants. An SMS campaign returns its text instead. Read-only; the raw HTML is never returned. Use it before editing with update_campaign_draft or before sending.

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID), as returned by list_campaigns.

get_campaign_report

Readaopy.read

Get a campaign report

Returns delivery, engagement and revenue results for one campaign: sent, delivered, bounced and held back; open rates (Total includes automatic Apple Mail opens; Accurate when available, its state says why when not), click rate, revenue, orders, email ROAS, the 10 most-clicked links and, for an A/B test, each variant's results and the winner. Read-only. Money is cents plus a formatted string in the organization's currency. Event lists are capped at 20.

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID), as returned by list_campaigns.

analyze_campaigns

Readaopy.read

Analyze campaigns

Ranks, compares or explains campaigns in one call. mode rank: the top campaigns of a window by revenue, orders, open rate, click rate or date. mode compare: 2 to 20 campaigns side by side. mode periods: how open, click, conversion and bounce rates, orders and revenue changed between two periods. Returns rates (Total and Accurate open rates apart), revenue in the organization's currency, subject-line features, averages, best and worst. Read-only. Next: get_campaign_report for one campaign, get_deliverability_report when opens or bounces moved.

ParameterTypeMeaning
moderequiredstring · rank | compare | periodsrank: the top campaigns of a window; compare: 2 to 20 campaigns side by side; periods: what changed between two periods.
windowstring · today | yesterday | last_7_days | last_30_days | last_90_daysPreset window ending today. Ignored when start_date and end_date are given.
start_datestring · ^\d{4}-\d{2}-\d{2}$First day, YYYY-MM-DD, inclusive. Use with end_date.
end_datestring · ^\d{4}-\d{2}-\d{2}$Last day, YYYY-MM-DD, inclusive. Use with start_date.
sort_bystring · revenue | orders | open_rate | click_rate | sent_atrank: what to rank by, best first (open_rate is the Total open rate). Default revenue.
limitinteger · >= 1 · <= 50rank: how many campaigns, 1 to 50. Default 10.
statusstring · sent | sending | paused | cancelledrank: only campaigns in this status. Default sent.
campaign_idsarray · 0-100 itemscompare: 2 to 20 campaign ids, as returned by list_campaigns.
period_aobjectperiods: the base period, up to 92 days.
period_bobjectperiods: the period compared with period_a, up to 92 days.
channelstring · email | smsperiods: limit the open and click rates to one channel.

get_best_send_time

Readaopy.read

Get the best send time

Finds the hour of day when this organization's emails get the most clicks, from the last 90 days of email clicks in the organization's time zone (opens are not used), with the full 24-hour click histogram. Below 30 clicks it reports that it is still learning and names no hour. Read-only. Next: schedule_campaign at that hour.

No parameters.

get_campaign_building_kit

Readaopy.read

Get the campaign building kit

Everything needed to build a branded email in Aopy: the Brand Kit colours, fonts and logo, the default sender, the email template list and every content block type with its fields and limits. Call it before create_campaign_draft, pick product ids with analyze_products or search_products, then pass blocks or template_id.

ParameterTypeMeaning
localestring · ro | enLanguage of the template names and copy. Defaults to the organization's language.

list_segments

Readaopy.read

List segments

Lists the organization's saved segments with contact counts (stored counts, refreshed in the background, so they can lag; count_as_of says when each was taken, count_is_stale that it is old; count_is_estimated marks a count scaled from a sample). A segment not counted yet has contact_count null and count_pending true; ask again in a minute. Split parts carry split_of_segment_id. Up to 100 per page; use page to continue. To find the best segments use rank_segments; to see one segment's numbers and rules use get_segment_metrics. Read-only.

ParameterTypeMeaning
searchstring · max 100 charsOnly segments whose name contains this text.
limitinteger · >= 1 · <= 100Page size, 1-100. Default 25.
pageinteger · >= 1 · <= 10Page number, 1-10. Default 1.

get_segment_metrics

Readaopy.read

Get segment metrics

One segment's numbers and rules: member count, 30-day growth, average order value, lifetime and campaign revenue (money as cents plus formatted, in currency), days since last activity (not last order), open and click rates (0-1) and engagement; filter_json is the stored rule tree to edit with update_segment, filter_summary the same rules in words. null means no data yet. count_pending: still being calculated, ask again in a minute. metrics_capped: over 10,000 members, so contact metrics are null. filter_is_masked: emails and names in the rules are hidden for your role. Read-only.

ParameterTypeMeaning
segment_idrequiredstring · uuidThe segment id (from list_segments).

get_segment_fields

Readaopy.read

Get segment fields

Lists every field a segment rule can use, with its operators, value shape, allowed values and limits, plus the tree grammar and a worked example. Call it before building a filter_json for preview_segment, create_segment or update_segment. Optional category narrows the list. Read-only; no data is read.

ParameterTypeMeaning
categorystring · behavioral | campaign | subscriber | consent | commerceOnly fields of this category: behavioral, campaign, subscriber, consent, commerce.

preview_segment

Readaopy.read

Preview a segment count

Counts how many contacts a rule tree matches without saving it. Give filter_json (build it with get_segment_fields) to count, or the job_id a previous call returned. status counted gives count and total_contacts; pending gives a job_id to check again in about 10 seconds (large audiences count in the background); invalid lists the problems to fix. Then save it with create_segment. Read-only.

ParameterTypeMeaning
filter_jsonobjectThe rule tree {version: 2, root: <group>} to count. See get_segment_fields.
job_idstring · uuidThe job_id of a pending count, to read its result.

rank_segments

Readaopy.read

Rank audiences

Ranks audiences in one call: RFM customer groups (Best customers, Regulars, At risk...) by store revenue, and saved segments and lists by the campaigns sent to them in the window: attributed revenue, click rate (fewer than 500 delivered ranks last as low_sample), size or 30-day growth. Use it for "which segments are best". Read-only. Next: get_segment_metrics for one segment, or create_campaign_draft with its segment_id.

ParameterTypeMeaning
windowstring · today | yesterday | last_7_days | last_30_days | last_90_daysCampaigns sent in this window count toward response and revenue. Ignored when start_date and end_date are given (at most 90 days). Default last_90_days.
start_datestring · ^\d{4}-\d{2}-\d{2}$First day, YYYY-MM-DD, inclusive. Use with end_date.
end_datestring · ^\d{4}-\d{2}-\d{2}$Last day, YYYY-MM-DD, inclusive. Use with start_date.
bystring · revenue | response | size | growthRank saved segments and lists by campaign revenue, response (click rate), size or growth (30 days). Default revenue.
limitinteger · >= 1 · <= 25How many saved segments and lists to return, 1-25. Default 10.

analyze_audience

Readaopy.read

Analyze the audience

Who the customers are, in one call: RFM groups (Best customers, Regulars, Slipping regulars, Gone...) with customers, orders, store revenue and the 30-day change, the biggest movements between groups, the RFM trend by band (daily over 90 days, weekly over 180 or 365), and email engagement buckets (high, medium, low, none, never emailed). Read-only, from daily rollups. Next: rank_segments to choose who to target, create_segment to save a group.

ParameterTypeMeaning
trend_daysnumber or number or numberDays of RFM trend: 90, 180 or 365. Default 90.

search_contacts

Readaopy.read

Search contacts

Searches the organization's contacts by name or email text, optionally narrowed to one list, segment or tag. Returns at most 50 per call, newest first, with a next_cursor for the following page. Emails and phone numbers are masked (for example a***@d***.ro); names, status, consent flags, order totals and up to 10 tags (tag_count: at least that many tags; the contact may have more) are returned. Read-only: it never changes a contact. Use get_contact for one profile.

ParameterTypeMeaning
querystring · max 500 charsText to find in name or email. At least 3 characters per word.
list_idstring · uuidOnly contacts in this list (id from list_lists).
segment_idstring · uuidOnly contacts in this segment (id from list_segments).
tag_idstring · uuidOnly contacts with this tag (id from list_tags).
limitinteger · >= 1 · <= 50Page size, 1-50. Default 25.
cursorstring · min 1 chars · max 4000 charsThe next_cursor from the previous page, to continue.

get_contact

Readaopy.read

Get a contact

Returns one contact's profile: name, status, consent, order totals, activity dates, up to 50 tags and lists, the RFM group (segment, recency, orders, revenue and average order in the organization's currency, churn risk 0-100, expected next order) and lifetime email engagement (sends, opens, clicks; opens include automatic ones by mail privacy features, so clicks are the stronger signal). The phone is always masked; the email is masked unless the connected user is an owner or admin. A block that could not be read is null with the reason in notes. Read-only.

ParameterTypeMeaning
contact_idrequiredstring · uuidThe contact id (from search_contacts).

list_lists

Readaopy.read

List contact lists

Lists the organization's contact lists with member counts (a null count means it could not be read right now), the default list 'All' first, then by name. Returns at most limit lists (1-50, default 25) of page (default 1); when has_more is true, call again with next_page as page. 'All' contains every contact and cannot be added to. Use the list id with search_contacts or add_contacts_to_list. Read-only.

ParameterTypeMeaning
searchstring · max 100 charsOnly lists whose name contains this text.
limitinteger · >= 1 · <= 50How many lists per page, 1-50. Default 25.
pageinteger · >= 1 · <= 1000Page number, from 1. Default 1; use next_page from the previous call.

list_tags

Readaopy.read

List tags

Lists the organization's contact tags by name (A to Z) with their contact counts. Returns at most limit tags (1-100, default 25); when has_more is true, pass next_cursor as cursor for the next page. Use a tag id with search_contacts to see who has it; create_tag makes a new one. Read-only.

ParameterTypeMeaning
searchstring · max 100 charsOnly tags whose name contains this text.
limitinteger · >= 1 · <= 100Page size, 1-100. Default 25.
cursorstring · min 1 chars · max 500 charsPaste next_cursor from the previous call to read the next page; leave it out for the first page.

list_automations

Readaopy.read

List automations

Lists the organization's automations (email flows) with status, trigger, goal, lifetime enrollments, sends, clicks and attributed revenue. At most 100 per page (default 20); use page for more. Revenue is lifetime, as formatted text plus raw cents. With include_templates true it also lists Aopy's ready-made flows (welcome, abandoned cart, browse, post-purchase, win-back, ...) and which ones this organization already created; make a missing one with create_automation_from_template.

ParameterTypeMeaning
statusstring · draft | active | paused | archivedOnly automations in this status.
searchstring · min 1 chars · max 100 charsPart of the automation name.
sort_bystring · created_at | updated_at | name | enrollment_countSort field. Default created_at, newest first.
limitinteger · >= 1 · <= 100Automations per page, 1-100. Default 20.
pageinteger · >= 1 · <= 1000Page number, starting at 1. Default 1.
include_templatesbooleanAlso list the ready-made templates, each with the ids this organization already created from it.
template_languagestring · en | roLanguage of the template names and descriptions. Default: the organization's language, the one a created draft is named in.

get_automation_stats

Readaopy.read

Automation statistics

Performance of one automation, chosen with automation_id (find it with list_automations; list_automations also gives each flow's lifetime totals): enrollments by state, emails sent, delivered, opened, clicked, bounced and unsubscribed with rates, and a per-step funnel (at most 100 steps). Contact details are not returned.

ParameterTypeMeaning
automation_idrequiredstring · uuidThe automation to inspect, an id from list_automations.

get_revenue_report

Readaopy.read

Revenue report

Store revenue for a date window (default last 30 days, at most 367): totals, average order value, email campaign and automation revenue, top campaigns and automations, and what each channel is credited. include adds attribution_models (both models per channel) and utm (per UTM source, medium or campaign), both 90 days at most, orders_by_status, and series (by day, week or month). Money is formatted text plus cents. Next: analyze_campaigns for campaign detail, analyze_products for products.

ParameterTypeMeaning
windowstring · today | yesterday | last_7_days | last_30_days | last_90_daysPreset window ending today. Ignored when start_date and end_date are given.
start_datestring · ^\d{4}-\d{2}-\d{2}$First day, YYYY-MM-DD, inclusive. Use with end_date.
end_datestring · ^\d{4}-\d{2}-\d{2}$Last day, YYYY-MM-DD, inclusive. Use with start_date.
includearray · 0-5 itemsSections to return: channels (the default), attribution_models, utm, orders_by_status, series. attribution_models and utm need a window of 90 days or fewer.
series_granularitystring · day | week | monthBucket of the series section: day, week (default) or month.
utm_group_bystring · source | medium | campaignUTM tag the utm section groups revenue by: source (default), medium or campaign.
top_limitinteger · >= 1 · <= 20How many top campaigns and top automations to return, 1-20. Default 5.

list_orders

Readaopy.read

List orders

Lists the store's orders, newest first, one page at a time (at most 100 per page, default 25). Optionally filter by a date window (at most 367 days) or a search text. Buyer emails are masked. When more orders exist the result carries next_cursor: pass it back as cursor to get the next page. For totals and trends use get_revenue_report.

ParameterTypeMeaning
windowstring · today | yesterday | last_7_days | last_30_days | last_90_daysPreset window ending today. Ignored when start_date and end_date are given.
start_datestring · ^\d{4}-\d{2}-\d{2}$First day, YYYY-MM-DD, inclusive. Use with end_date.
end_datestring · ^\d{4}-\d{2}-\d{2}$Last day, YYYY-MM-DD, inclusive. Use with start_date.
searchstring · min 1 chars · max 100 charsOrder number or buyer text to search for.
limitinteger · >= 1 · <= 100Orders per page, 1-100. Default 25.
cursorobjectThe next_cursor from the previous page.

analyze_products

Readaopy.read

Analyze products

Best-selling products. basis store_sales (default): units and revenue per product from store orders, window at most 92 days within the last 4 months. basis units: units sold in the last 90 days (48 hours for today or yesterday; any other window is refused, use store_sales), with data_as_of and stale. basis ads: revenue credited to ad clicks with spend and ROAS, at most 20 products, only with an ad platform connected. A non-null product_id goes straight into a products block of create_campaign_draft; to find a product by name use search_products.

ParameterTypeMeaning
windowstring · today | yesterday | last_7_days | last_30_days | last_90_daysPreset window ending today. Ignored when start_date and end_date are given.
start_datestring · ^\d{4}-\d{2}-\d{2}$First day, YYYY-MM-DD, inclusive. Use with end_date.
end_datestring · ^\d{4}-\d{2}-\d{2}$Last day, YYYY-MM-DD, inclusive. Use with start_date.
basisstring · store_sales | ads | unitsstore_sales (default): units and revenue from store orders. units: units sold in the last 90 days, or the last 48 hours for window today or yesterday. ads: revenue credited to ad clicks, with spend and ROAS.
limitinteger · >= 1 · <= 50How many products, 1-50 (ads: at most 20). Default 10.
sortstring · revenue | units | top | roas_desc | roas_asc | spend_desc | spend_ascstore_sales: revenue (default) or units. ads, with a platform: top (default), roas_desc, roas_asc, spend_desc, spend_asc.
platformstring · meta | google | tiktokbasis ads only: rank for one ad platform. Omit for all channels together.

search_products

Readaopy.read

Search products

Finds catalogue products by name or SKU to put in a campaign: each product_id goes straight into a products block of create_campaign_draft. Sold-out products are listed with in_stock false unless in_stock_only is true. At most 25 per page and 4 pages; past that, refine the query. For best sellers use analyze_products.

ParameterTypeMeaning
queryrequiredstring · min 2 chars · max 100 charsWords from the product name, or a SKU.
in_stock_onlybooleanOnly products in stock. Default false: sold-out products are listed and marked.
limitinteger · >= 1 · <= 25Products per page, 1-25. Default 10.
pageinteger · >= 1 · <= 4Page 1-4. Default 1.

get_deliverability_report

Readaopy.read

Deliverability report

One read-only health check of email delivery: status against Aopy's thresholds for the window and the last 7 days, bounces and spam complaints, suppressions, mailbox providers, DKIM/SPF/DMARC per sending domain, account health checks, Gmail Postmaster numbers and whether sending is paused or slowed, with plain findings on what to fix. Use it when opens, bounces or spam complaints are a concern. Next: analyze_campaigns to find the campaign behind a spike.

ParameterTypeMeaning
window_daysnumber or numberDays to report on, 7 or 30, ending today. Default 30.

Write tools (11)

Create and edit drafts, segments, tags, lists and draft automations, or send a test email to yourself. Nothing reaches your customers.

create_campaign_draft

Writeaopy.write

Create a campaign draft

Creates an email campaign as a DRAFT; it never sends or schedules. Content is exactly one of: blocks (branded hero, text, buttons, images, live product cards), template_id (a ready-made template in its own design) or body_text (plain text). Aopy adds the unsubscribe link and legal footer itself. Call get_campaign_building_kit first for the brand, templates and blocks. Pass segment_id (list_segments) or list_ids (list_lists) for the audience, optionally narrowed by excluded_segment_ids or intersect_segment_id; without one it cannot be sent until update_campaign_draft sets it.

ParameterTypeMeaning
namerequiredstring · min 1 chars · max 100 charsInternal campaign name, up to 100 characters.
subjectrequiredstring · min 1 chars · max 200 charsThe email subject line, up to 200 characters.
preview_textstring · max 200 charsInbox preview text, up to 200 characters.
body_textstring · min 1 chars · max 20000 charsPlain-text body. A blank line starts a new paragraph. Links and HTML are shown as text; for a designed email use blocks. Aopy adds the unsubscribe link and legal footer.
blocksarray · 1-30 itemsThe email, top to bottom, as content blocks (types: hero, text, button, image, products, divider, spacer). Rendered in the brand's colours and fonts, with the logo where the organization places it. Aopy adds the unsubscribe link and the legal footer itself: add none. get_campaign_building_kit lists every block's fields.
template_idstring · min 1 chars · max 100 charsA ready-made template id from get_campaign_building_kit (use 'campaign'). It keeps the template's own design; its text and images are sample copy to replace.
apply_brandbooleanWith blocks: use the Brand Kit's colours and fonts. Defaults to true when a Brand Kit exists; false keeps the default look. A template keeps its own design, so true is refused with template_id.
from_namestring · min 1 chars · max 100 charsSender display name. Defaults to the organization's sending domain default.
reply_tostring · emailReply-to address. Defaults to the organization's default.
segment_idstring · uuidSend to this segment (an id from list_segments). Give segment_id or list_ids, not both.
list_idsarray · 1-100 itemsSend to these lists (ids from list_lists). Give list_ids or segment_id, not both.
excluded_segment_idsarray · 0-100 itemsLeave the contacts of these segments out (ids from list_segments), e.g. VIPs out of a win-back. Replaces the draft's excluded segments; [] clears them. Needs an audience: segment_id or list_ids, now or already on the draft.
intersect_segment_idstring or nullSend only to audience contacts who are also in this segment (an id from list_segments), as the app's "active contacts only". null clears it. Needs an audience, as above.

update_campaign_draft

Writeaopy.write

Update a campaign draft

Changes a campaign that is still a DRAFT: name, subject, preview text, sender name, reply-to, audience (segment_id or list_ids, excluded_segment_ids, intersect_segment_id) or its content. Content is one of blocks, template_id or body_text, as in create_campaign_draft, and replaces the whole body; Aopy adds the unsubscribe link and legal footer itself. Refuses a campaign that is scheduled, sending, paused, cancelled or sent. It never schedules or sends.

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID).
namestring · min 1 chars · max 100 charsNew internal name.
subjectstring · min 1 chars · max 200 charsNew subject line.
preview_textstring · max 200 charsNew inbox preview text.
from_namestring · min 1 chars · max 100 charsNew sender display name.
reply_tostring · emailNew reply-to address.
body_textstring · min 1 chars · max 20000 charsPlain-text body. A blank line starts a new paragraph. Links and HTML are shown as text; for a designed email use blocks. Aopy adds the unsubscribe link and legal footer.
blocksarray · 1-30 itemsThe email, top to bottom, as content blocks (types: hero, text, button, image, products, divider, spacer). Rendered in the brand's colours and fonts, with the logo where the organization places it. Aopy adds the unsubscribe link and the legal footer itself: add none. get_campaign_building_kit lists every block's fields.
template_idstring · min 1 chars · max 100 charsA ready-made template id from get_campaign_building_kit (use 'campaign'). It keeps the template's own design; its text and images are sample copy to replace.
apply_brandbooleanWith blocks: use the Brand Kit's colours and fonts. Defaults to true when a Brand Kit exists; false keeps the default look. A template keeps its own design, so true is refused with template_id.
segment_idstring · uuidSend to this segment (an id from list_segments). Give segment_id or list_ids, not both.
list_idsarray · 1-100 itemsSend to these lists (ids from list_lists). Give list_ids or segment_id, not both.
excluded_segment_idsarray · 0-100 itemsLeave the contacts of these segments out (ids from list_segments), e.g. VIPs out of a win-back. Replaces the draft's excluded segments; [] clears them. Needs an audience: segment_id or list_ids, now or already on the draft.
intersect_segment_idstring or nullSend only to audience contacts who are also in this segment (an id from list_segments), as the app's "active contacts only". null clears it. Needs an audience, as above.

send_test_email

Writeaopy.write

Send a test email to yourself

Sends one test copy of a campaign to the email address of the signed-in Aopy user who connected this assistant, and only that address; there is no way to choose another recipient. This is the only email the Create permission can send, and it goes only to you. Uses sample merge values and is rate limited. It does not send the campaign to the audience.

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID).

create_ab_test

Writeaopy.write

Set up an A/B test

Turns a DRAFT campaign into an A/B test of its subject, preview text, sender name or send time, with 2 to 5 variants. Each variant sets only the tested field; everything else comes from the campaign. A share of the audience (test_percentage) gets the variants; after duration_hours the winner by opens, clicks or revenue goes to the rest. Nothing is sent: then call send_campaign or schedule_campaign as usual. Calling it again replaces the variants. Results show in get_campaign_report once it is sent.

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID). The campaign must be a draft.
variablerequiredstring · subject | preview_text | from_name | send_timeWhat the variants differ in. Content is not offered: it is never tested.
variantsrequiredarray · 2-5 items2 to 5 variants, each setting only the field named by variable.
winner_criteriarequiredstring · opens | clicks | revenueHow the winner is picked.
duration_hoursrequiredinteger · >= 1 · <= 336How long the test runs before the winner is picked, 1 to 336 hours.
test_percentagerequiredinteger · >= 10 · <= 50Share of the audience that gets the test variants, 10 to 50.
winner_percentageinteger · >= 50 · <= 90Share that gets the winner. Always 100 minus test_percentage; best left out.
auto_send_winnerbooleanDefault true: the winner goes to the rest of the audience by itself when the test ends. false is a test only: the winner is recorded and the rest of the audience gets nothing.

create_segment

Writeaopy.write

Create a segment

Creates a saved segment from a rule tree {version: 2, root: group}. Build the tree with get_segment_fields and check its size with preview_segment first. The count is calculated in the background (status evaluating); read it with get_segment_metrics. Fails if the name exists. It does not email anyone, change contacts or edit other segments.

ParameterTypeMeaning
namerequiredstring · min 1 chars · max 100 charsSegment name, 1-100 characters, unique among custom segments.
filter_jsonrequiredobjectThe rule tree {version: 2, root: <group>}, exactly as the segment builder saves it. Fields, operators, value shapes and an example: get_segment_fields.
descriptionstring · max 500 charsOptional description, up to 500 characters.

update_segment

Writeaopy.write

Update a segment

Renames, re-describes or changes the rules of a saved segment. Read its current rules (filter_json) with get_segment_metrics, edit them, and send the whole new tree. When the rules change the new count is calculated in the background (status evaluating; read it with get_segment_metrics in a minute). A split part keeps its parent's rules: edit the parent instead. Built-in segments are refused, as in the app. New rules are refused while the segment (or a split part) starts an active automation or is the audience of a scheduled campaign, since that would email customers. It emails nobody.

ParameterTypeMeaning
segment_idrequiredstring · uuidThe segment id (from list_segments).
namestring · min 1 chars · max 100 charsNew name, 1-100 characters, unique in the organization.
descriptionstring · max 500 charsNew description, up to 500 characters.
filter_jsonobjectThe whole new rule tree {version: 2, root: <group>}. See get_segment_fields.

split_segment

Writeaopy.write

Split a segment

Splits a saved segment into 2-20 equal random parts (for batch sends or tests). Each part is a new segment that follows the parent's rules; a contact stays in one part. Refuses a part of a part and a segment that is already split. Counts are calculated in the background; read them with list_segments or get_segment_metrics. It emails nobody: the parent keeps its members, and the parts are new segments no automation or campaign uses yet.

ParameterTypeMeaning
segment_idrequiredstring · uuidThe segment to split (from list_segments).
partsrequiredinteger · >= 2 · <= 20Number of parts, 2-20.

create_tag

Writeaopy.write

Create a tag

Creates a new contact tag. Fails if a tag with the same name exists (find it with list_tags instead). It does not apply the tag to any contact.

ParameterTypeMeaning
namerequiredstring · min 1 chars · max 50 charsTag name, 1-50 characters.
colorstring · ^#[0-9A-Fa-f]{6}$Hex color such as #6B7280. Optional.
descriptionstring · max 200 charsOptional description, up to 200 characters.

add_contacts_to_list

Writeaopy.write

Add contacts to a list

Adds up to 500 specific contacts to a contact list. Contacts already in the list are skipped. It cannot add to the default 'All' list and does not remove anyone. It refuses a list that starts an active automation or is the audience of a scheduled campaign, since adding would email those contacts; it sends no email itself. Adding a whole audience (more than 500) is a background job in the app and is not available here; split the ids or use the Audience page. Check the new member count with list_lists.

ParameterTypeMeaning
list_idrequiredstring · uuidThe list id (from list_lists).
contact_idsrequiredarray · 1-500 itemsContact ids (from search_contacts), 1-500 per call.

create_automation_from_template

Writeaopy.write

Create an automation from a template

Creates an automation (welcome, abandoned cart, browse, post-purchase, win-back, ...) from Aopy's ready-made template as a DRAFT, with emails in the organization's language. Nothing is sent and nobody is enrolled until activate_automation. One per template: when one already exists (draft, active, paused, or archived and still counted) it is returned instead and nothing is created. Returns the draft's steps; the user can edit them in Aopy before turning it on.

ParameterTypeMeaning
template_keyrequiredstring · review_request_fulfilled | nps_survey_fulfilled | welcome_series | abandoned_cart | checkout_abandoned | browse_abandoned | post_purchase | post_purchase_perk | review_request | winback | cross_sell | birthday | account_anniversary | price_alertThe template, a key from list_automations with include_templates true.

pause_automation

Writeaopy.write

Pause an automation

Pauses an active automation so it stops sending. Nobody is removed from the flow: people already in it are held and continue when it is turned on again with activate_automation. Pausing one that is already paused changes nothing.

ParameterTypeMeaning
automation_idrequiredstring · uuidThe automation id (a UUID) from list_automations or create_automation_from_template.

Destructive tools (7)

Each needs your explicit confirmation in the chat. Sending tools change what reaches real contacts: send, schedule or resume a campaign, turn an automation on, or stop a campaign. Deleting tools remove an unused draft or segment, never anything that was sent, and change nothing your customers receive.

schedule_campaign

Destructiveaopy.send

Schedule a campaign

Schedules a DRAFT campaign to send at a chosen date and time. Goes through the same checks as the Aopy app (content, sending domain, consent, plan quota, abuse limits, canary), so it can refuse or hold the campaign; refusals are returned as written. With confirm false it only returns who the campaign goes to (the segment or lists) and the estimated recipient count, plus a preview_token, and changes nothing; a draft with no audience is not ready and says how to set one (update_campaign_draft). With confirm true the campaign is armed and will be emailed to real people at the chosen time; until then stop_campaign with action unschedule undoes it. Confirm true is refused without the preview_token from the confirm false call (valid 10 minutes, for this campaign, audience, date and time only). Time is in the organization's time zone unless time_zone is given.

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID). The campaign must be a draft.
local_daterequiredstring · ^\d{4}-\d{2}-\d{2}$Send date as YYYY-MM-DD.
local_timerequiredstring · ^([01]\d|2[0-3]):[0-5]\d$Send time as 24-hour HH:MM.
confirmrequiredbooleanMust be true to act. Call first with false to get the audience (who it goes to and the recipient estimate); show that to the user and only call again with true, together with the preview_token from that first call, after the user has explicitly agreed.
time_zonestring · max 64 charsOptional IANA time zone such as Europe/Bucharest. Defaults to the organization's time zone.
preview_tokenstring · max 200 charsRequired when confirm is true: the preview_token returned by the confirm false call. Valid 10 minutes and only for this campaign as previewed: its audience, subject, content and A/B test (and, for schedule_campaign, this date and time). Single use: once a confirm true call accepts it, it cannot be used again; preview again for a new one.

send_campaign

Destructiveaopy.send

Send a campaign

Sends a DRAFT campaign to its audience. Goes through the same checks as the Aopy Send button (content, sending domain, consent, plan quota, abuse limits, canary), so it can refuse or hold the campaign; refusals are returned as written. Like that button, it starts a 5 minute undo window: the campaign is queued to go out in about 5 minutes; until then stop_campaign with action unschedule undoes it. With confirm false it only returns who the campaign goes to (the segment or lists) and the estimated recipient count, plus a preview_token, and changes nothing; a draft with no audience is not ready and says how to set one (update_campaign_draft). With confirm true real people get the email; it is refused without the preview_token from the confirm false call (valid 10 minutes, for this campaign and audience only).

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID). The campaign must be a draft.
confirmrequiredbooleanMust be true to act. Call first with false to get the audience (who it goes to and the recipient estimate); show that to the user and only call again with true, together with the preview_token from that first call, after the user has explicitly agreed.
preview_tokenstring · max 200 charsRequired when confirm is true: the preview_token returned by the confirm false call. Valid 10 minutes and only for this campaign as previewed: its audience, subject, content and A/B test (and, for schedule_campaign, this date and time). Single use: once a confirm true call accepts it, it cannot be used again; preview again for a new one.

stop_campaign

Destructiveaopy.write

Stop a campaign

Stops a campaign without sending anything. action unschedule: a scheduled campaign goes back to a draft (this also undoes send_campaign during its 5 minute window). action pause: a campaign that is sending stops; resume_campaign continues it. action cancel: a sending or paused campaign stops for good and cannot be undone; call with confirm false first, show the user, then confirm true with the preview_token once they agree. Unschedule and pause act at once. An SMS campaign that is sending cannot be paused, only cancelled. Any other status is refused with the action to use instead.

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID).
actionrequiredstring · unschedule | pause | cancelunschedule (scheduled to draft), pause (sending to paused) or cancel (sending or paused to cancelled, cannot be undone).
confirmbooleanOnly for cancel: false or left out returns what cancelling means and a preview_token, changing nothing; true cancels, with that preview_token, after the user agreed. Ignored for unschedule and pause.
preview_tokenstring · max 200 charsRequired when confirm is true: the preview_token returned by the confirm false call. Valid 10 minutes, only for this campaign, single use.

resume_campaign

Destructiveaopy.send

Resume a paused campaign

Resumes a PAUSED campaign so the rest of its audience receives it: this emails real people. With confirm false it only returns the campaign, its audience and how many received it so far, plus a preview_token, and changes nothing; a campaign that is not paused, or was paused automatically for review, is not ready and says why. With confirm true sending restarts, under the same checks as the Aopy Resume button; it is refused without the preview_token from the confirm false call (valid 10 minutes, single use).

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe campaign id (a UUID).
confirmrequiredbooleanMust be true to act. Call first with false, show the result to the user, and only call again with true, together with the preview_token from that first call, after the user has explicitly agreed.
preview_tokenstring · max 200 charsRequired when confirm is true: the preview_token returned by the confirm false call. Valid 10 minutes, only for this campaign, single use.

activate_automation

Destructiveaopy.send

Turn on an automation

Turns on (or resumes) an automation so it emails real people as they trigger it. Call with confirm false first: it changes nothing and returns readiness, blockers, the new-contact safety gate and a preview_token. Show that to the user and only after they agree call again with confirm true and that token (valid 10 minutes, void if the automation is edited). Aopy's activation checks still apply; their refusals are returned as written. Stop it with pause_automation.

ParameterTypeMeaning
automation_idrequiredstring · uuidThe automation id (a UUID) from list_automations or create_automation_from_template.
confirmrequiredbooleanfalse: preview only, changes nothing. true: turn it on; needs the preview_token from the confirm false call and the user's explicit agreement.
preview_tokenstring · max 200 charsRequired when confirm is true: the preview_token returned by the confirm false call.
test_contact_idstring · uuidOptional contact id (from search_contacts) to preview the path that person would take; nothing is sent to them.

delete_campaign_draft

Destructiveaopy.write

Delete a campaign draft

Deletes a campaign DRAFT that is no longer needed, with its A/B variants. Only a draft never sent, not scheduled and with nothing sent from it; anything else is refused. confirm false returns what would be deleted (name, created date, A/B variants, why it is deletable) and a preview_token, deleting nothing. Ask the user, and only after they agree call again with confirm true and that preview_token (valid 10 minutes, single use). Cannot be undone. A draft already gone answers already_deleted.

ParameterTypeMeaning
campaign_idrequiredstring · uuidThe draft's campaign id (a UUID).
confirmrequiredbooleanfalse returns what would be deleted and a preview_token, deleting nothing. true deletes, with that preview_token, only after the user agreed.
preview_tokenstring · max 200 charsRequired when confirm is true: the preview_token from the confirm false call. Valid 10 minutes, only for this item as previewed, single use.

delete_segment

Destructiveaopy.write

Delete a segment

Deletes a saved segment that is no longer needed; contacts are not deleted, only the segment. Refused for a built-in segment and while any campaign (any status, also as exclusion or intersect), automation, split part or ad audience uses it. confirm false returns what would be deleted (name, created date, why it is deletable) and a preview_token, deleting nothing. Ask the user, and only after they agree call again with confirm true and that preview_token (valid 10 minutes, single use). Cannot be undone. A segment already gone answers already_deleted.

ParameterTypeMeaning
segment_idrequiredstring · uuidThe segment id (from list_segments).
confirmrequiredbooleanfalse returns what would be deleted and a preview_token, deleting nothing. true deletes, with that preview_token, only after the user agreed.
preview_tokenstring · max 200 charsRequired when confirm is true: the preview_token from the confirm false call. Valid 10 minutes, only for this item as previewed, single use.

Support

Questions or problems with the connector: write to support@aopy.com, or see the contact page.