Campaign and ad set on conversations from ads
Give WASync a Meta Ads token and every conversation that starts from a Click-to-WhatsApp ad carries the campaign, the ad set and the ad in the UTM fields of the lead or deal, with their names on the timeline.
When a customer writes to you from a Click-to-WhatsApp ad, WhatsApp tells
WASync which ad it was, and nothing more. WASync writes that on the lead or
deal: UTM_SOURCE = facebook, UTM_MEDIUM = ctwa, the ad id in UTM Campaign
and the click id in UTM Content, plus the UF_CRM_CTWA_* fields.
To report by campaign and ad set you need the two ids Meta does not send with the message. WASync can look them up in your ad account if you give it a token of your own Business Manager. With the token in place the UTM fields follow Meta's own convention:
| Field | Value |
|---|---|
| UTM Campaign | campaign id |
| UTM Term | ad set id |
| UTM Content | ad id |
The click id stays in UF_CRM_CTWA_CLID, and the timeline note on the record
shows the names: Campaign: «Préstamos octubre» (1202…), Ad set: «Profes»
(1202…), Ad: «FACSIS IA» 1202….
1. Create a System User token with ads_read
Five steps, once, about ten minutes. Everything happens in Meta's own interfaces; WASync only receives the token at the end.
1.1 An app with the Marketing API product
Meta only issues a token through an app of your own portfolio, and the token dialog lists only the permissions that app can grant. If your portfolio already has an app with the Marketing API product, use it. If not, create one once at developers.facebook.com/apps: Create app. Meta's wizard first asks for a use case: pick Other (the last card at the bottom, labelled "this option is going away soon"), which opens the previous experience: type Business → pick your business portfolio → once the app exists, Add product → Marketing API → Set up. In the new experience, the use case under Ads and monetisation that creates and manages ads with the Marketing API leads to the same place. Do not pick "Create an app without a use case": it has no products. No code and no App Review are needed.
Then switch the new app to Live mode: in the app, App settings → Basic,
fill in Privacy policy URL (your website's privacy page) and save, then
turn on the App Mode toggle at the top of the page (Development → Live).
An app left in development mode is refused intermittently with
(#200) API access blocked, so some ads resolve and others keep only their id.
1.2 A system user
In Meta Business Suite → Business settings → Users → System users → Add. Name it in lowercase, for example wasync attribution (Meta refuses names with several capital letters); the Employee role is enough.
1.3 Give it the ad account
Open the system user → Assign assets → Ad accounts → tick the ad account that runs your Click-to-WhatsApp ads → View performance (read is enough) → Save.
1.4 Give it the app
Still on the system user → Assign assets → Apps → tick the app from step 1.1 → Develop app → Save. This is the step most people miss: without it, the token dialog shows only the WhatsApp permissions and ads_read is not in the list.
1.5 Generate the token
System user → Generate token → choose the app from step 1.1 → expiry Never → tick ads_read only → Generate token → copy it. Meta shows it once; if you close the dialog, generate a new one.
2. Paste it in WASync
Open the WASync app in Bitrix24 → Settings → the card Campaign and ad set on conversations from ads. Paste the token and click Save token. WASync stores it encrypted and never shows it again.
To check it, paste the numeric id of one of your ads (from Ads Manager, the Ad ID column) and click Test: the card shows the campaign, the ad set and the ad that WASync would write.
3. IDs or names in the UTM fields
Once the token is saved, the card shows Write in UTM fields: IDs / Names.
- IDs (the default) writes the campaign id, ad set id and ad id, as in the table above. IDs never change, so a report keeps working when someone renames a campaign in Ads Manager.
- Names writes the names as they are in Ads Manager instead:
| Field | Value with Names |
|---|---|
| UTM Campaign | campaign name |
| UTM Term | ad set name |
| UTM Content | ad name |
Names are easier to read in Bitrix24 reports and dashboards. A name longer
than 255 characters is cut at 255. If Meta returns no name for one level, that
field gets the id. The ad id always stays in UF_CRM_CTWA_SOURCE_ID, and the
timeline note always shows every name with its id, so nothing is lost either
way.
The choice applies to new conversations from ads, including the ones matched from the message text. Records written before you switch keep their values; if you need earlier leads and deals rewritten to names, write to support.
If something does not work
- ads_read is not in the token dialog. The system user has no role on the app (step 1.4), or the app has no Marketing API product (step 1.1). Fix one of the two and open Generate token again.
- The app is not offered in the token dialog. The app belongs to another business portfolio. Create the app under the portfolio that owns the ad account, or assign it to the system user from that portfolio.
- Test says the token is invalid or expired. The token was generated with an expiry, or from an app that was later removed. Generate a new one with expiry Never and save it again.
- Test says the ad was not found. The ad belongs to an ad account the system user does not have (step 1.3), or the id is a campaign or ad set id. Use the Ad ID column of Ads Manager.
- Leads still show only the ad id. The token applies to new conversations only; records attributed before the token keep what they have.
What changes, and what does not
- Only new conversations from ads get the three ids (or names, see IDs or names); records attributed before the token keep what they have.
- A record that already has a
UTM Sourcefrom another channel is never overwritten; theUF_CRM_CTWA_*fields are always written. - Each ad is looked up once and remembered for a day, so a campaign with thousands of conversations costs one request to Meta.
- If Meta refuses the lookup (expired token, an ad from another ad account), the conversation is attributed as before, with the ad id only, and nothing else breaks.
- Remove the token at any time with Remove token; WASync goes back to writing the ad id only.
Related: CRM records and timeline.