Find and replace text in ads
adsap_replace_ad_textChange the same text in many Meta ads at once, for example an old offer or a number that changed. Works on the ads of ONE ad set or ONE campaign per call. Step 1, preview (dry_run true, the default): pass find, replace_with and ad_set_id or campaign_id. It searches up to 500 ads with the same rule as adsap_list_ads text (upper and lower case ignored, line breaks and repeated spaces count as one space, emojis, punctuation and digits exact), replaces every occurrence by replace_with exactly as typed, and previews each ad without changing anything. It returns preview_id, the ads that would change with each text before and after, held (ads where another setting would also change), cannot_change (texts Adsap cannot change: carousel cards, Flexible ads, catalog ads, ads made from an existing post) and meta.active_ads (how many of these ads are running). Show the user ONE list: every ad with its before and after text, then the held and cannot_change ads with their reasons. Each changed ad gets a new creative: on a running ad this can restart learning and reset the likes and comments shown, so when meta.active_ads is above 0 say so. Apply only after the user confirms. Step 2, apply: pass the same ad_account_id, dry_run false and preview_id (within 30 minutes). Held ads are left out unless their ids are in ad_ids, and only after the user agreed to the other setting change; pass ad_ids also to apply only some ads. Each call changes ads for about 35 seconds and answers with what changed; when meta.remaining is above 0, call again with the same preview_id until it is 0. An ad changed by someone else after the preview is skipped, never overwritten. Every text you do not ask to change stays as it is, and so do the enhancements, Shop, the button, the link and the media. Say nothing about the settings checks when they find nothing. Only for ads listed under warnings (after the apply): tell the user which settings Meta reports as different, using the names and values returned. More than 50 ads to change: apply these, then preview again for the rest. One task is counted per ad changed. To change other fields (link, button, media) or one ad in a custom way, use adsap_replace_ad_creative.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"ad_account_id": "<ad_account_id>"
},
"name": "adsap_replace_ad_text"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| find | No | Preview only: the text to find. Upper and lower case and extra spaces are ignored; emojis, punctuation and digits must match exactly. | |
| after | No | Preview only: meta.paging_after from a previous preview, to search the ads after the first 500. | |
| ad_ids | No | Apply only: change only these ads of the preview. Held ads are changed only when named here. | |
| fields | No | Preview only: which texts to change. Default: all three (primary_text, headline, description). | |
| dry_run | No | true (default) = preview, nothing is changed. false = apply a preview (needs preview_id). | |
| ad_set_id | No | Preview only: the ad set whose ads to search (numeric). Pass exactly one of ad_set_id or campaign_id. | |
| preview_id | No | Apply only: the preview_id returned by the preview. | |
| campaign_id | No | Preview only: the campaign whose ads to search, across its ad sets (numeric). Pass exactly one of ad_set_id or campaign_id. | |
| replace_with | No | Preview only: the new text, used exactly as typed (case included). An empty string removes the text found. | |
| ad_account_id | Yes | Ad account ID (act_xxx). Required in both steps. |