late-sdk 0.0.906 → 0.0.908
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/docs/AccountWithFollowerStats.md +2 -2
- data/docs/AdAccountsApi.md +1 -1
- data/docs/ConnectAds200ResponseOneOf.md +2 -0
- data/docs/ConnectApi.md +79 -5
- data/docs/LeadGenApi.md +5 -5
- data/docs/ListAdAccounts200ResponseAccountsInner.md +4 -0
- data/docs/SocialAccount.md +2 -2
- data/lib/zernio-sdk/api/ad_accounts_api.rb +2 -2
- data/lib/zernio-sdk/api/connect_api.rb +91 -6
- data/lib/zernio-sdk/api/lead_gen_api.rb +8 -8
- data/lib/zernio-sdk/models/account_with_follower_stats.rb +2 -2
- data/lib/zernio-sdk/models/connect_ads200_response_one_of.rb +45 -1
- data/lib/zernio-sdk/models/list_ad_accounts200_response_accounts_inner.rb +21 -1
- data/lib/zernio-sdk/models/social_account.rb +2 -2
- data/lib/zernio-sdk/version.rb +1 -1
- data/openapi.yaml +93 -6
- data/spec/api/ad_accounts_api_spec.rb +1 -1
- data/spec/api/connect_api_spec.rb +19 -3
- data/spec/api/lead_gen_api_spec.rb +4 -4
- data/spec/models/connect_ads200_response_one_of_spec.rb +10 -0
- data/spec/models/list_ad_accounts200_response_accounts_inner_spec.rb +12 -0
- data/zernio-sdk-0.0.908.gem +0 -0
- metadata +2 -2
- data/zernio-sdk-0.0.906.gem +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62dbb90fbfabfd6315efd18af91db31687d9f771780b8c2b1fb8d285846a6bda
|
|
4
|
+
data.tar.gz: 18586efd5787dbcee4024e1c6e02e816118284413b822f4be0ef504050488fe0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 38912882c7da96bd189576b840f9680fd7a7989dac260f83a03179a2863c6ec4fa5238c3f88f65c9009f8256c9e265e822c1e72a4b04d42de51c37f6c8007f87
|
|
7
|
+
data.tar.gz: e5a9cd81e4db3687695af930b796beaf6096ce5ea5a044e90fc059aed4217e96a73ddfdd43bbae19d327889c73ad89113993dce7c96ad76c84001377bba45027
|
data/README.md
CHANGED
|
@@ -360,6 +360,7 @@ Class | Method | HTTP request | Description
|
|
|
360
360
|
*Zernio::CommentsApi* | [**unlike_inbox_comment**](docs/CommentsApi.md#unlike_inbox_comment) | **DELETE** /v1/inbox/comments/{postId}/{commentId}/like | Unlike comment
|
|
361
361
|
*Zernio::CommentsApi* | [**unlike_post**](docs/CommentsApi.md#unlike_post) | **DELETE** /v1/inbox/posts/{postId}/like | Unlike post
|
|
362
362
|
*Zernio::ConnectApi* | [**assign_google_business_location**](docs/ConnectApi.md#assign_google_business_location) | **POST** /v1/accounts/{accountId}/gmb-locations/assign | Assign Google Business Profile location to another profile
|
|
363
|
+
*Zernio::ConnectApi* | [**complete_meta_ads_business_login**](docs/ConnectApi.md#complete_meta_ads_business_login) | **GET** /v1/connect/meta-ads/callback | Complete Meta business login
|
|
363
364
|
*Zernio::ConnectApi* | [**complete_telegram_connect**](docs/ConnectApi.md#complete_telegram_connect) | **PATCH** /v1/connect/telegram | Check Telegram status
|
|
364
365
|
*Zernio::ConnectApi* | [**complete_whats_app_phone_selection**](docs/ConnectApi.md#complete_whats_app_phone_selection) | **POST** /v1/connect/whatsapp/select-phone-number | Complete number selection
|
|
365
366
|
*Zernio::ConnectApi* | [**configure_tik_tok_ads_brand_identity**](docs/ConnectApi.md#configure_tik_tok_ads_brand_identity) | **PATCH** /v1/connect/tiktok-ads | Set TikTok brand identity
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
| **needs_reconnection** | **Boolean** | The platform definitively reported the stored OAuth token as dead. While true, GET /v1/connect/{platform}/ads returns a fresh authUrl (implicit force=true) instead of alreadyConnected, so re-running the connect flow recovers the account. Cleared automatically when the account is re-authorized. | [optional] |
|
|
16
16
|
| **followers_count** | **Float** | Follower count (only included if user has analytics add-on) | [optional] |
|
|
17
17
|
| **followers_last_updated** | **Time** | Last time follower count was updated (only included if user has analytics add-on) | [optional] |
|
|
18
|
-
| **parent_account_id** | **String** | Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. | [optional] |
|
|
18
|
+
| **parent_account_id** | **String** | Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. Meta ads business-login accounts also have no parent. | [optional] |
|
|
19
19
|
| **enabled** | **Boolean** | Whether the user explicitly activated this account. false means the account was created as a side effect (e.g., posting account auto-created when user connected ads first). Such accounts are hidden from this list, cannot be posted to (`ACCOUNT_NOT_ENABLED_FOR_POSTING`), and are not billed as connected accounts. | [optional] |
|
|
20
|
-
| **metadata** | **Object** | Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName. | [optional] |
|
|
20
|
+
| **metadata** | **Object** | Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For Meta ads business-login accounts: - tokenType: system-user - businessId: The owning Business Manager ID when there is one owner; null for multiple owners. - businessIds: Owning Business Manager IDs discovered from granted ad accounts. - grantedAdAccountIds: Ad-account IDs granted to the token. - adAccountBusinesses: Map from ad-account ID to its owning business ID or null. - availablePages: Granted Page IDs and names. No Page tokens are exposed. - selectedPageId: The Page selected for creatives and lead forms, or null. - scopedAdAccountIds: Existing sync scope preserved on reconnect. Non-expiring tokens have no tokenExpiresAt field. Parent posting reconnects do not replace this token. For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName. | [optional] |
|
|
21
21
|
| **current_followers** | **Float** | Current follower count | [optional] |
|
|
22
22
|
| **last_updated** | **Time** | | [optional] |
|
|
23
23
|
| **growth** | **Float** | Follower change over period | [optional] |
|
data/docs/AdAccountsApi.md
CHANGED
|
@@ -1732,7 +1732,7 @@ end
|
|
|
1732
1732
|
|
|
1733
1733
|
List ad accounts
|
|
1734
1734
|
|
|
1735
|
-
Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
|
|
1735
|
+
Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). Meta business-login accounts use their own system-user token. Fresh Meta discovery includes businessId and businessName from the owning Business Manager when available; cached entries gain these fields after the next discovery refresh. For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
|
|
1736
1736
|
|
|
1737
1737
|
### Examples
|
|
1738
1738
|
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
| **platform** | **String** | | [optional] |
|
|
10
10
|
| **username** | **String** | | [optional] |
|
|
11
11
|
| **display_name** | **String** | | [optional] |
|
|
12
|
+
| **token_type** | **String** | Present for an existing business-login connection. | [optional] |
|
|
12
13
|
| **scoped_ad_account_ids** | **Array<String>** | Echo of the persisted ad-account scope when the caller passed `adAccountId` / `adAccountIds`. Omitted when no scope is set. | [optional] |
|
|
13
14
|
|
|
14
15
|
## Example
|
|
@@ -22,6 +23,7 @@ instance = Zernio::ConnectAds200ResponseOneOf.new(
|
|
|
22
23
|
platform: null,
|
|
23
24
|
username: null,
|
|
24
25
|
display_name: null,
|
|
26
|
+
token_type: null,
|
|
25
27
|
scoped_ad_account_ids: ["act_1330190928038136"]
|
|
26
28
|
)
|
|
27
29
|
```
|
data/docs/ConnectApi.md
CHANGED
|
@@ -5,6 +5,7 @@ All URIs are relative to *https://zernio.com/api*
|
|
|
5
5
|
| Method | HTTP request | Description |
|
|
6
6
|
| ------ | ------------ | ----------- |
|
|
7
7
|
| [**assign_google_business_location**](ConnectApi.md#assign_google_business_location) | **POST** /v1/accounts/{accountId}/gmb-locations/assign | Assign Google Business Profile location to another profile |
|
|
8
|
+
| [**complete_meta_ads_business_login**](ConnectApi.md#complete_meta_ads_business_login) | **GET** /v1/connect/meta-ads/callback | Complete Meta business login |
|
|
8
9
|
| [**complete_telegram_connect**](ConnectApi.md#complete_telegram_connect) | **PATCH** /v1/connect/telegram | Check Telegram status |
|
|
9
10
|
| [**complete_whats_app_phone_selection**](ConnectApi.md#complete_whats_app_phone_selection) | **POST** /v1/connect/whatsapp/select-phone-number | Complete number selection |
|
|
10
11
|
| [**configure_tik_tok_ads_brand_identity**](ConnectApi.md#configure_tik_tok_ads_brand_identity) | **PATCH** /v1/connect/tiktok-ads | Set TikTok brand identity |
|
|
@@ -128,6 +129,75 @@ end
|
|
|
128
129
|
- **Accept**: application/json
|
|
129
130
|
|
|
130
131
|
|
|
132
|
+
## complete_meta_ads_business_login
|
|
133
|
+
|
|
134
|
+
> complete_meta_ads_business_login(state, opts)
|
|
135
|
+
|
|
136
|
+
Complete Meta business login
|
|
137
|
+
|
|
138
|
+
Facebook Login for Business redirect target. Meta supplies the single-use authorization code and the authenticated state returned by connectAds. The state expires after 30 minutes and binds the user, profile, Page selection and ad-account scope. No bearer token is sent by the browser. Success reconnects only metaads and redirects to the original redirect_url. Invalid state returns 400; inaccessible profiles or missing ads access cannot connect. No token is returned to the browser.
|
|
139
|
+
|
|
140
|
+
### Examples
|
|
141
|
+
|
|
142
|
+
```ruby
|
|
143
|
+
require 'time'
|
|
144
|
+
require 'zernio-sdk'
|
|
145
|
+
|
|
146
|
+
api_instance = Zernio::ConnectApi.new
|
|
147
|
+
state = 'ENCRYPTED_STATE' # String | Authenticated state from the initial connectAds response.
|
|
148
|
+
opts = {
|
|
149
|
+
code: 'code_example', # String | Single-use authorization code returned by Meta.
|
|
150
|
+
error: 'error_example' # String | Meta authorization error when the user declines the dialog.
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
begin
|
|
154
|
+
# Complete Meta business login
|
|
155
|
+
api_instance.complete_meta_ads_business_login(state, opts)
|
|
156
|
+
rescue Zernio::ApiError => e
|
|
157
|
+
puts "Error when calling ConnectApi->complete_meta_ads_business_login: #{e}"
|
|
158
|
+
end
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### Using the complete_meta_ads_business_login_with_http_info variant
|
|
162
|
+
|
|
163
|
+
This returns an Array which contains the response data (`nil` in this case), status code and headers.
|
|
164
|
+
|
|
165
|
+
> <Array(nil, Integer, Hash)> complete_meta_ads_business_login_with_http_info(state, opts)
|
|
166
|
+
|
|
167
|
+
```ruby
|
|
168
|
+
begin
|
|
169
|
+
# Complete Meta business login
|
|
170
|
+
data, status_code, headers = api_instance.complete_meta_ads_business_login_with_http_info(state, opts)
|
|
171
|
+
p status_code # => 2xx
|
|
172
|
+
p headers # => { ... }
|
|
173
|
+
p data # => nil
|
|
174
|
+
rescue Zernio::ApiError => e
|
|
175
|
+
puts "Error when calling ConnectApi->complete_meta_ads_business_login_with_http_info: #{e}"
|
|
176
|
+
end
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Parameters
|
|
180
|
+
|
|
181
|
+
| Name | Type | Description | Notes |
|
|
182
|
+
| ---- | ---- | ----------- | ----- |
|
|
183
|
+
| **state** | **String** | Authenticated state from the initial connectAds response. | |
|
|
184
|
+
| **code** | **String** | Single-use authorization code returned by Meta. | [optional] |
|
|
185
|
+
| **error** | **String** | Meta authorization error when the user declines the dialog. | [optional] |
|
|
186
|
+
|
|
187
|
+
### Return type
|
|
188
|
+
|
|
189
|
+
nil (empty response body)
|
|
190
|
+
|
|
191
|
+
### Authorization
|
|
192
|
+
|
|
193
|
+
No authorization required
|
|
194
|
+
|
|
195
|
+
### HTTP request headers
|
|
196
|
+
|
|
197
|
+
- **Content-Type**: Not defined
|
|
198
|
+
- **Accept**: application/json
|
|
199
|
+
|
|
200
|
+
|
|
131
201
|
## complete_telegram_connect
|
|
132
202
|
|
|
133
203
|
> <CompleteTelegramConnect200Response> complete_telegram_connect(code)
|
|
@@ -345,7 +415,7 @@ end
|
|
|
345
415
|
|
|
346
416
|
Connect ads for a platform
|
|
347
417
|
|
|
348
|
-
Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
418
|
+
Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Meta business login (opt-in).** Set `loginMode=business` for `facebook` or `instagram` to use Facebook Login for Business and a Business Integration System User token. No posting account is created or required. This mode always returns an authUrl; it returns 503 when the server has no META_ADS_CONFIG_ID. Complete the dialog in a browser. The callback creates or reconnects only the metaads account, preserving its ID, history and scopedAdAccountIds. Non-empty successful subscription results replace subscribedAdAccountIds to remove stale grants; an empty result leaves routing unchanged. A reconnect must grant every previously scoped ad account (or every previous grant for an unscoped connection). Missing or unverifiable grants return 409 before changing the account. Pass `pageId` to select a granted Page for creatives and lead forms. Otherwise the previous Page or sole granted Page is selected. Multiple Pages without a selection return 400 with available Page IDs; restart with pageId. With no Pages granted the account can manage campaigns and sync insights but cannot create Page-based creatives or list Page forms. Success redirects with connected=metaads, profileId and accountId. Business login reports metadata.tokenType=system-user in GET /v1/accounts. An absent Meta expires_in leaves tokenExpiresAt absent; no personal-token re-exchange occurs. Subsequent classic requests can change the ad-account scope using the business token; force=true requires loginMode=business to reconnect that connection. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
349
419
|
|
|
350
420
|
### Examples
|
|
351
421
|
|
|
@@ -359,14 +429,16 @@ Zernio.configure do |config|
|
|
|
359
429
|
end
|
|
360
430
|
|
|
361
431
|
api_instance = Zernio::ConnectApi.new
|
|
362
|
-
platform = 'facebook' # String | Platform to connect ads for. Only platforms with ads support are accepted. `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
432
|
+
platform = 'facebook' # String | Platform to connect ads for. Only platforms with ads support are accepted. In classic mode, `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
363
433
|
profile_id = 'profile_id_example' # String | Your Zernio profile ID
|
|
364
434
|
opts = {
|
|
435
|
+
login_mode: 'classic', # String | Meta ads authorization mode. Business login is opt-in for Facebook and Instagram; classic preserves the posting-account flow.
|
|
436
|
+
page_id: '811889972008357', # String | Business login only. Facebook Page ID to select from the token grants for ad creatives and lead forms.
|
|
365
437
|
account_id: 'account_id_example', # String | Existing SocialAccount ID. Required for `twitter` (X Ads). Optional for `tiktok`: omit to enter ads-only mode (no TikTok posting account linked; ad creation uses a Brand Identity instead of a TT_USER). Ignored for same-token (`facebook`, `instagram`, `linkedin`, `pinterest`) and standalone (`googleads`) platforms.
|
|
366
438
|
redirect_url: 'redirect_url_example', # String | Custom URL the browser is sent to once the OAuth flow finishes. Honored on every ads platform, including the separate-token (`tiktok`, `twitter`) and standalone (`googleads`) flows. MUST be an absolute http(s) URL or a custom app scheme for mobile deeplinks (e.g. myapp://callback); a relative path is rejected with 400 INVALID_REDIRECT_URL. On success `tiktok`, `twitter` and `googleads` land on the URL unchanged, while the same-token platforms (`facebook`, `instagram`, `linkedin`, `pinterest`) append `connected`, `profileId`, `accountId`, `username` and, on API-key calls, `connect_token`. On failure the same error contract applies as on GET /v1/connect/{platform}: `error` and `platform` are always appended, other params are optional, and the value list there is not exhaustive. On the tiktok, twitter and googleads flows `platform` carries the ads platform id (`tiktokads`, `xads`, `googleads`), not the value used in the request path. When omitted, the browser lands on the Zernio dashboard.
|
|
367
439
|
headless: true, # Boolean | Enable headless mode (same-token platforms only)
|
|
368
440
|
force: true, # Boolean | Force a fresh OAuth even when an account already exists. Normally the endpoint returns `alreadyConnected: true` whenever a connected account is found, keying off its active state rather than token liveness. Set `force=true` to bypass that and always receivean `authUrl`. Completing the returned OAuth refreshes the stored token on the existing posting and ads accounts in place.
|
|
369
|
-
ad_account_id: 'act_1330190928038136', # String | Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead.
|
|
441
|
+
ad_account_id: 'act_1330190928038136', # String | Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Business-login reconnects preserve the existing scope; supplied IDs are checked against the new grant. To change that scope after migration, call this endpoint with the IDs and omit loginMode. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead.
|
|
370
442
|
ad_account_ids: ['inner_example'] # Array<String> | Scope ad sync to multiple platform ad accounts (same platform support and id shapes as `adAccountId`). Repeat the param (`?adAccountIds=act_1&adAccountIds=act_2`) or comma-separate (`?adAccountIds=act_1,act_2`). Persisted server-side; latest call wins, and de-scoped ad accounts have their synced ads removed. Omitting both `adAccountId` and `adAccountIds` keeps any previously persisted scope unchanged.
|
|
371
443
|
}
|
|
372
444
|
|
|
@@ -401,13 +473,15 @@ end
|
|
|
401
473
|
|
|
402
474
|
| Name | Type | Description | Notes |
|
|
403
475
|
| ---- | ---- | ----------- | ----- |
|
|
404
|
-
| **platform** | **String** | Platform to connect ads for. Only platforms with ads support are accepted. `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts. | |
|
|
476
|
+
| **platform** | **String** | Platform to connect ads for. Only platforms with ads support are accepted. In classic mode, `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts. | |
|
|
405
477
|
| **profile_id** | **String** | Your Zernio profile ID | |
|
|
478
|
+
| **login_mode** | **String** | Meta ads authorization mode. Business login is opt-in for Facebook and Instagram; classic preserves the posting-account flow. | [optional][default to 'classic'] |
|
|
479
|
+
| **page_id** | **String** | Business login only. Facebook Page ID to select from the token grants for ad creatives and lead forms. | [optional] |
|
|
406
480
|
| **account_id** | **String** | Existing SocialAccount ID. Required for `twitter` (X Ads). Optional for `tiktok`: omit to enter ads-only mode (no TikTok posting account linked; ad creation uses a Brand Identity instead of a TT_USER). Ignored for same-token (`facebook`, `instagram`, `linkedin`, `pinterest`) and standalone (`googleads`) platforms. | [optional] |
|
|
407
481
|
| **redirect_url** | **String** | Custom URL the browser is sent to once the OAuth flow finishes. Honored on every ads platform, including the separate-token (`tiktok`, `twitter`) and standalone (`googleads`) flows. MUST be an absolute http(s) URL or a custom app scheme for mobile deeplinks (e.g. myapp://callback); a relative path is rejected with 400 INVALID_REDIRECT_URL. On success `tiktok`, `twitter` and `googleads` land on the URL unchanged, while the same-token platforms (`facebook`, `instagram`, `linkedin`, `pinterest`) append `connected`, `profileId`, `accountId`, `username` and, on API-key calls, `connect_token`. On failure the same error contract applies as on GET /v1/connect/{platform}: `error` and `platform` are always appended, other params are optional, and the value list there is not exhaustive. On the tiktok, twitter and googleads flows `platform` carries the ads platform id (`tiktokads`, `xads`, `googleads`), not the value used in the request path. When omitted, the browser lands on the Zernio dashboard. | [optional] |
|
|
408
482
|
| **headless** | **Boolean** | Enable headless mode (same-token platforms only) | [optional][default to false] |
|
|
409
483
|
| **force** | **Boolean** | Force a fresh OAuth even when an account already exists. Normally the endpoint returns `alreadyConnected: true` whenever a connected account is found, keying off its active state rather than token liveness. Set `force=true` to bypass that and always receivean `authUrl`. Completing the returned OAuth refreshes the stored token on the existing posting and ads accounts in place. | [optional][default to false] |
|
|
410
|
-
| **ad_account_id** | **String** | Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead. | [optional] |
|
|
484
|
+
| **ad_account_id** | **String** | Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Business-login reconnects preserve the existing scope; supplied IDs are checked against the new grant. To change that scope after migration, call this endpoint with the IDs and omit loginMode. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead. | [optional] |
|
|
411
485
|
| **ad_account_ids** | [**Array<String>**](String.md) | Scope ad sync to multiple platform ad accounts (same platform support and id shapes as `adAccountId`). Repeat the param (`?adAccountIds=act_1&adAccountIds=act_2`) or comma-separate (`?adAccountIds=act_1,act_2`). Persisted server-side; latest call wins, and de-scoped ad accounts have their synced ads removed. Omitting both `adAccountId` and `adAccountIds` keeps any previously persisted scope unchanged. | [optional] |
|
|
412
486
|
|
|
413
487
|
### Return type
|
data/docs/LeadGenApi.md
CHANGED
|
@@ -90,7 +90,7 @@ end
|
|
|
90
90
|
|
|
91
91
|
Create a lead form
|
|
92
92
|
|
|
93
|
-
Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
|
|
93
|
+
Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (a facebook account or a metaads business-login account with a selected Page) (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
|
|
94
94
|
|
|
95
95
|
### Examples
|
|
96
96
|
|
|
@@ -299,7 +299,7 @@ end
|
|
|
299
299
|
|
|
300
300
|
List leads for a single form
|
|
301
301
|
|
|
302
|
-
Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.
|
|
302
|
+
Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read. Accepts a Facebook account or a metaads business-login account with leads_retrieval access to the form; the latter uses its system-user token without a posting parent.
|
|
303
303
|
|
|
304
304
|
### Examples
|
|
305
305
|
|
|
@@ -378,7 +378,7 @@ end
|
|
|
378
378
|
|
|
379
379
|
List lead forms
|
|
380
380
|
|
|
381
|
-
Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
|
|
381
|
+
Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page, including a Page selected on a metaads business-login connection. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
|
|
382
382
|
|
|
383
383
|
### Examples
|
|
384
384
|
|
|
@@ -392,7 +392,7 @@ Zernio.configure do |config|
|
|
|
392
392
|
end
|
|
393
393
|
|
|
394
394
|
api_instance = Zernio::LeadGenApi.new
|
|
395
|
-
account_id = 'account_id_example' # String | Connected
|
|
395
|
+
account_id = 'account_id_example' # String | Connected Facebook, Meta ads business-login or LinkedIn ads account ID.
|
|
396
396
|
opts = {
|
|
397
397
|
ad_account_id: 'ad_account_id_example', # String | LinkedIn only: the LinkedIn ad account id (used to resolve the owning organization). Required for LinkedIn.
|
|
398
398
|
limit: 56, # Integer |
|
|
@@ -430,7 +430,7 @@ end
|
|
|
430
430
|
|
|
431
431
|
| Name | Type | Description | Notes |
|
|
432
432
|
| ---- | ---- | ----------- | ----- |
|
|
433
|
-
| **account_id** | **String** | Connected
|
|
433
|
+
| **account_id** | **String** | Connected Facebook, Meta ads business-login or LinkedIn ads account ID. | |
|
|
434
434
|
| **ad_account_id** | **String** | LinkedIn only: the LinkedIn ad account id (used to resolve the owning organization). Required for LinkedIn. | [optional] |
|
|
435
435
|
| **limit** | **Integer** | | [optional][default to 25] |
|
|
436
436
|
| **cursor** | **String** | | [optional] |
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
| **id** | **String** | Platform ad account ID (e.g. act_123) | [optional] |
|
|
8
8
|
| **name** | **String** | | [optional] |
|
|
9
9
|
| **currency** | **String** | | [optional] |
|
|
10
|
+
| **business_id** | **String** | Meta only. Owning Business Manager ID when available on the grant. | [optional] |
|
|
11
|
+
| **business_name** | **String** | Owning business name when supplied by the platform. | [optional] |
|
|
10
12
|
| **status** | **String** | LinkedIn only. LinkedIn's own ad account status. In practice always `ACTIVE`, because the LinkedIn query filters to active accounts. Meta, Google, TikTok and Pinterest report `accountStatus` instead; X reports `approvalStatus`. | [optional] |
|
|
11
13
|
| **account_status** | **Object** | | [optional] |
|
|
12
14
|
| **approval_status** | **String** | X only. X's own ad account approval status. Observed values are `ACCEPTED`, `PENDING` and `REJECTED`, but X does not publish the full vocabulary, so treat an unrecognised value as not usable. Other platforms report `accountStatus` or `status` instead. | [optional] |
|
|
@@ -26,6 +28,8 @@ instance = Zernio::ListAdAccounts200ResponseAccountsInner.new(
|
|
|
26
28
|
id: null,
|
|
27
29
|
name: null,
|
|
28
30
|
currency: null,
|
|
31
|
+
business_id: null,
|
|
32
|
+
business_name: null,
|
|
29
33
|
status: null,
|
|
30
34
|
account_status: null,
|
|
31
35
|
approval_status: null,
|
data/docs/SocialAccount.md
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
| **needs_reconnection** | **Boolean** | The platform definitively reported the stored OAuth token as dead. While true, GET /v1/connect/{platform}/ads returns a fresh authUrl (implicit force=true) instead of alreadyConnected, so re-running the connect flow recovers the account. Cleared automatically when the account is re-authorized. | [optional] |
|
|
16
16
|
| **followers_count** | **Float** | Follower count (only included if user has analytics add-on) | [optional] |
|
|
17
17
|
| **followers_last_updated** | **Time** | Last time follower count was updated (only included if user has analytics add-on) | [optional] |
|
|
18
|
-
| **parent_account_id** | **String** | Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. | [optional] |
|
|
18
|
+
| **parent_account_id** | **String** | Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. Meta ads business-login accounts also have no parent. | [optional] |
|
|
19
19
|
| **enabled** | **Boolean** | Whether the user explicitly activated this account. false means the account was created as a side effect (e.g., posting account auto-created when user connected ads first). Such accounts are hidden from this list, cannot be posted to (`ACCOUNT_NOT_ENABLED_FOR_POSTING`), and are not billed as connected accounts. | [optional] |
|
|
20
|
-
| **metadata** | **Object** | Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName. | [optional] |
|
|
20
|
+
| **metadata** | **Object** | Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For Meta ads business-login accounts: - tokenType: system-user - businessId: The owning Business Manager ID when there is one owner; null for multiple owners. - businessIds: Owning Business Manager IDs discovered from granted ad accounts. - grantedAdAccountIds: Ad-account IDs granted to the token. - adAccountBusinesses: Map from ad-account ID to its owning business ID or null. - availablePages: Granted Page IDs and names. No Page tokens are exposed. - selectedPageId: The Page selected for creatives and lead forms, or null. - scopedAdAccountIds: Existing sync scope preserved on reconnect. Non-expiring tokens have no tokenExpiresAt field. Parent posting reconnects do not replace this token. For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName. | [optional] |
|
|
21
21
|
|
|
22
22
|
## Example
|
|
23
23
|
|
|
@@ -1787,7 +1787,7 @@ module Zernio
|
|
|
1787
1787
|
end
|
|
1788
1788
|
|
|
1789
1789
|
# List ad accounts
|
|
1790
|
-
# Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
|
|
1790
|
+
# Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). Meta business-login accounts use their own system-user token. Fresh Meta discovery includes businessId and businessName from the owning Business Manager when available; cached entries gain these fields after the next discovery refresh. For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
|
|
1791
1791
|
# @param account_id [String] Account ID
|
|
1792
1792
|
# @param [Hash] opts the optional parameters
|
|
1793
1793
|
# @option opts [String] :ad_account_id Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.
|
|
@@ -1799,7 +1799,7 @@ module Zernio
|
|
|
1799
1799
|
end
|
|
1800
1800
|
|
|
1801
1801
|
# List ad accounts
|
|
1802
|
-
# Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
|
|
1802
|
+
# Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). Meta business-login accounts use their own system-user token. Fresh Meta discovery includes businessId and businessName from the owning Business Manager when available; cached entries gain these fields after the next discovery refresh. For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
|
|
1803
1803
|
# @param account_id [String] Account ID
|
|
1804
1804
|
# @param [Hash] opts the optional parameters
|
|
1805
1805
|
# @option opts [String] :ad_account_id Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.
|
|
@@ -93,6 +93,76 @@ module Zernio
|
|
|
93
93
|
return data, status_code, headers
|
|
94
94
|
end
|
|
95
95
|
|
|
96
|
+
# Complete Meta business login
|
|
97
|
+
# Facebook Login for Business redirect target. Meta supplies the single-use authorization code and the authenticated state returned by connectAds. The state expires after 30 minutes and binds the user, profile, Page selection and ad-account scope. No bearer token is sent by the browser. Success reconnects only metaads and redirects to the original redirect_url. Invalid state returns 400; inaccessible profiles or missing ads access cannot connect. No token is returned to the browser.
|
|
98
|
+
# @param state [String] Authenticated state from the initial connectAds response.
|
|
99
|
+
# @param [Hash] opts the optional parameters
|
|
100
|
+
# @option opts [String] :code Single-use authorization code returned by Meta.
|
|
101
|
+
# @option opts [String] :error Meta authorization error when the user declines the dialog.
|
|
102
|
+
# @return [nil]
|
|
103
|
+
def complete_meta_ads_business_login(state, opts = {})
|
|
104
|
+
complete_meta_ads_business_login_with_http_info(state, opts)
|
|
105
|
+
nil
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Complete Meta business login
|
|
109
|
+
# Facebook Login for Business redirect target. Meta supplies the single-use authorization code and the authenticated state returned by connectAds. The state expires after 30 minutes and binds the user, profile, Page selection and ad-account scope. No bearer token is sent by the browser. Success reconnects only metaads and redirects to the original redirect_url. Invalid state returns 400; inaccessible profiles or missing ads access cannot connect. No token is returned to the browser.
|
|
110
|
+
# @param state [String] Authenticated state from the initial connectAds response.
|
|
111
|
+
# @param [Hash] opts the optional parameters
|
|
112
|
+
# @option opts [String] :code Single-use authorization code returned by Meta.
|
|
113
|
+
# @option opts [String] :error Meta authorization error when the user declines the dialog.
|
|
114
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
115
|
+
def complete_meta_ads_business_login_with_http_info(state, opts = {})
|
|
116
|
+
if @api_client.config.debugging
|
|
117
|
+
@api_client.config.logger.debug 'Calling API: ConnectApi.complete_meta_ads_business_login ...'
|
|
118
|
+
end
|
|
119
|
+
# verify the required parameter 'state' is set
|
|
120
|
+
if @api_client.config.client_side_validation && state.nil?
|
|
121
|
+
fail ArgumentError, "Missing the required parameter 'state' when calling ConnectApi.complete_meta_ads_business_login"
|
|
122
|
+
end
|
|
123
|
+
# resource path
|
|
124
|
+
local_var_path = '/v1/connect/meta-ads/callback'
|
|
125
|
+
|
|
126
|
+
# query parameters
|
|
127
|
+
query_params = opts[:query_params] || {}
|
|
128
|
+
query_params[:'state'] = state
|
|
129
|
+
query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
|
|
130
|
+
query_params[:'error'] = opts[:'error'] if !opts[:'error'].nil?
|
|
131
|
+
|
|
132
|
+
# header parameters
|
|
133
|
+
header_params = opts[:header_params] || {}
|
|
134
|
+
# HTTP header 'Accept' (if needed)
|
|
135
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
136
|
+
|
|
137
|
+
# form parameters
|
|
138
|
+
form_params = opts[:form_params] || {}
|
|
139
|
+
|
|
140
|
+
# http body (model)
|
|
141
|
+
post_body = opts[:debug_body]
|
|
142
|
+
|
|
143
|
+
# return_type
|
|
144
|
+
return_type = opts[:debug_return_type]
|
|
145
|
+
|
|
146
|
+
# auth_names
|
|
147
|
+
auth_names = opts[:debug_auth_names] || []
|
|
148
|
+
|
|
149
|
+
new_options = opts.merge(
|
|
150
|
+
:operation => :"ConnectApi.complete_meta_ads_business_login",
|
|
151
|
+
:header_params => header_params,
|
|
152
|
+
:query_params => query_params,
|
|
153
|
+
:form_params => form_params,
|
|
154
|
+
:body => post_body,
|
|
155
|
+
:auth_names => auth_names,
|
|
156
|
+
:return_type => return_type
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
160
|
+
if @api_client.config.debugging
|
|
161
|
+
@api_client.config.logger.debug "API called: ConnectApi#complete_meta_ads_business_login\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
162
|
+
end
|
|
163
|
+
return data, status_code, headers
|
|
164
|
+
end
|
|
165
|
+
|
|
96
166
|
# Check Telegram status
|
|
97
167
|
# Poll this endpoint to check if a Telegram access code has been used to connect a channel/group. Recommended polling interval: 3 seconds. Status values: pending (waiting for user), connected (channel/group linked), expired (generate a new code).
|
|
98
168
|
# @param code [String] The access code to check status for
|
|
@@ -297,15 +367,17 @@ module Zernio
|
|
|
297
367
|
end
|
|
298
368
|
|
|
299
369
|
# Connect ads for a platform
|
|
300
|
-
# Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
301
|
-
# @param platform [String] Platform to connect ads for. Only platforms with ads support are accepted. `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
370
|
+
# Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Meta business login (opt-in).** Set `loginMode=business` for `facebook` or `instagram` to use Facebook Login for Business and a Business Integration System User token. No posting account is created or required. This mode always returns an authUrl; it returns 503 when the server has no META_ADS_CONFIG_ID. Complete the dialog in a browser. The callback creates or reconnects only the metaads account, preserving its ID, history and scopedAdAccountIds. Non-empty successful subscription results replace subscribedAdAccountIds to remove stale grants; an empty result leaves routing unchanged. A reconnect must grant every previously scoped ad account (or every previous grant for an unscoped connection). Missing or unverifiable grants return 409 before changing the account. Pass `pageId` to select a granted Page for creatives and lead forms. Otherwise the previous Page or sole granted Page is selected. Multiple Pages without a selection return 400 with available Page IDs; restart with pageId. With no Pages granted the account can manage campaigns and sync insights but cannot create Page-based creatives or list Page forms. Success redirects with connected=metaads, profileId and accountId. Business login reports metadata.tokenType=system-user in GET /v1/accounts. An absent Meta expires_in leaves tokenExpiresAt absent; no personal-token re-exchange occurs. Subsequent classic requests can change the ad-account scope using the business token; force=true requires loginMode=business to reconnect that connection. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
371
|
+
# @param platform [String] Platform to connect ads for. Only platforms with ads support are accepted. In classic mode, `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
302
372
|
# @param profile_id [String] Your Zernio profile ID
|
|
303
373
|
# @param [Hash] opts the optional parameters
|
|
374
|
+
# @option opts [String] :login_mode Meta ads authorization mode. Business login is opt-in for Facebook and Instagram; classic preserves the posting-account flow. (default to 'classic')
|
|
375
|
+
# @option opts [String] :page_id Business login only. Facebook Page ID to select from the token grants for ad creatives and lead forms.
|
|
304
376
|
# @option opts [String] :account_id Existing SocialAccount ID. Required for `twitter` (X Ads). Optional for `tiktok`: omit to enter ads-only mode (no TikTok posting account linked; ad creation uses a Brand Identity instead of a TT_USER). Ignored for same-token (`facebook`, `instagram`, `linkedin`, `pinterest`) and standalone (`googleads`) platforms.
|
|
305
377
|
# @option opts [String] :redirect_url Custom URL the browser is sent to once the OAuth flow finishes. Honored on every ads platform, including the separate-token (`tiktok`, `twitter`) and standalone (`googleads`) flows. MUST be an absolute http(s) URL or a custom app scheme for mobile deeplinks (e.g. myapp://callback); a relative path is rejected with 400 INVALID_REDIRECT_URL. On success `tiktok`, `twitter` and `googleads` land on the URL unchanged, while the same-token platforms (`facebook`, `instagram`, `linkedin`, `pinterest`) append `connected`, `profileId`, `accountId`, `username` and, on API-key calls, `connect_token`. On failure the same error contract applies as on GET /v1/connect/{platform}: `error` and `platform` are always appended, other params are optional, and the value list there is not exhaustive. On the tiktok, twitter and googleads flows `platform` carries the ads platform id (`tiktokads`, `xads`, `googleads`), not the value used in the request path. When omitted, the browser lands on the Zernio dashboard.
|
|
306
378
|
# @option opts [Boolean] :headless Enable headless mode (same-token platforms only) (default to false)
|
|
307
379
|
# @option opts [Boolean] :force Force a fresh OAuth even when an account already exists. Normally the endpoint returns `alreadyConnected: true` whenever a connected account is found, keying off its active state rather than token liveness. Set `force=true` to bypass that and always receivean `authUrl`. Completing the returned OAuth refreshes the stored token on the existing posting and ads accounts in place. (default to false)
|
|
308
|
-
# @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead.
|
|
380
|
+
# @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Business-login reconnects preserve the existing scope; supplied IDs are checked against the new grant. To change that scope after migration, call this endpoint with the IDs and omit loginMode. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead.
|
|
309
381
|
# @option opts [Array<String>] :ad_account_ids Scope ad sync to multiple platform ad accounts (same platform support and id shapes as `adAccountId`). Repeat the param (`?adAccountIds=act_1&adAccountIds=act_2`) or comma-separate (`?adAccountIds=act_1,act_2`). Persisted server-side; latest call wins, and de-scoped ad accounts have their synced ads removed. Omitting both `adAccountId` and `adAccountIds` keeps any previously persisted scope unchanged.
|
|
310
382
|
# @return [ConnectAds200Response]
|
|
311
383
|
def connect_ads(platform, profile_id, opts = {})
|
|
@@ -314,15 +386,17 @@ module Zernio
|
|
|
314
386
|
end
|
|
315
387
|
|
|
316
388
|
# Connect ads for a platform
|
|
317
|
-
# Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
318
|
-
# @param platform [String] Platform to connect ads for. Only platforms with ads support are accepted. `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
389
|
+
# Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Meta business login (opt-in).** Set `loginMode=business` for `facebook` or `instagram` to use Facebook Login for Business and a Business Integration System User token. No posting account is created or required. This mode always returns an authUrl; it returns 503 when the server has no META_ADS_CONFIG_ID. Complete the dialog in a browser. The callback creates or reconnects only the metaads account, preserving its ID, history and scopedAdAccountIds. Non-empty successful subscription results replace subscribedAdAccountIds to remove stale grants; an empty result leaves routing unchanged. A reconnect must grant every previously scoped ad account (or every previous grant for an unscoped connection). Missing or unverifiable grants return 409 before changing the account. Pass `pageId` to select a granted Page for creatives and lead forms. Otherwise the previous Page or sole granted Page is selected. Multiple Pages without a selection return 400 with available Page IDs; restart with pageId. With no Pages granted the account can manage campaigns and sync insights but cannot create Page-based creatives or list Page forms. Success redirects with connected=metaads, profileId and accountId. Business login reports metadata.tokenType=system-user in GET /v1/accounts. An absent Meta expires_in leaves tokenExpiresAt absent; no personal-token re-exchange occurs. Subsequent classic requests can change the ad-account scope using the business token; force=true requires loginMode=business to reconnect that connection. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
390
|
+
# @param platform [String] Platform to connect ads for. Only platforms with ads support are accepted. In classic mode, `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
319
391
|
# @param profile_id [String] Your Zernio profile ID
|
|
320
392
|
# @param [Hash] opts the optional parameters
|
|
393
|
+
# @option opts [String] :login_mode Meta ads authorization mode. Business login is opt-in for Facebook and Instagram; classic preserves the posting-account flow. (default to 'classic')
|
|
394
|
+
# @option opts [String] :page_id Business login only. Facebook Page ID to select from the token grants for ad creatives and lead forms.
|
|
321
395
|
# @option opts [String] :account_id Existing SocialAccount ID. Required for `twitter` (X Ads). Optional for `tiktok`: omit to enter ads-only mode (no TikTok posting account linked; ad creation uses a Brand Identity instead of a TT_USER). Ignored for same-token (`facebook`, `instagram`, `linkedin`, `pinterest`) and standalone (`googleads`) platforms.
|
|
322
396
|
# @option opts [String] :redirect_url Custom URL the browser is sent to once the OAuth flow finishes. Honored on every ads platform, including the separate-token (`tiktok`, `twitter`) and standalone (`googleads`) flows. MUST be an absolute http(s) URL or a custom app scheme for mobile deeplinks (e.g. myapp://callback); a relative path is rejected with 400 INVALID_REDIRECT_URL. On success `tiktok`, `twitter` and `googleads` land on the URL unchanged, while the same-token platforms (`facebook`, `instagram`, `linkedin`, `pinterest`) append `connected`, `profileId`, `accountId`, `username` and, on API-key calls, `connect_token`. On failure the same error contract applies as on GET /v1/connect/{platform}: `error` and `platform` are always appended, other params are optional, and the value list there is not exhaustive. On the tiktok, twitter and googleads flows `platform` carries the ads platform id (`tiktokads`, `xads`, `googleads`), not the value used in the request path. When omitted, the browser lands on the Zernio dashboard.
|
|
323
397
|
# @option opts [Boolean] :headless Enable headless mode (same-token platforms only) (default to false)
|
|
324
398
|
# @option opts [Boolean] :force Force a fresh OAuth even when an account already exists. Normally the endpoint returns `alreadyConnected: true` whenever a connected account is found, keying off its active state rather than token liveness. Set `force=true` to bypass that and always receivean `authUrl`. Completing the returned OAuth refreshes the stored token on the existing posting and ads accounts in place. (default to false)
|
|
325
|
-
# @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead.
|
|
399
|
+
# @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Business-login reconnects preserve the existing scope; supplied IDs are checked against the new grant. To change that scope after migration, call this endpoint with the IDs and omit loginMode. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead.
|
|
326
400
|
# @option opts [Array<String>] :ad_account_ids Scope ad sync to multiple platform ad accounts (same platform support and id shapes as `adAccountId`). Repeat the param (`?adAccountIds=act_1&adAccountIds=act_2`) or comma-separate (`?adAccountIds=act_1,act_2`). Persisted server-side; latest call wins, and de-scoped ad accounts have their synced ads removed. Omitting both `adAccountId` and `adAccountIds` keeps any previously persisted scope unchanged.
|
|
327
401
|
# @return [Array<(ConnectAds200Response, Integer, Hash)>] ConnectAds200Response data, response status code and response headers
|
|
328
402
|
def connect_ads_with_http_info(platform, profile_id, opts = {})
|
|
@@ -342,12 +416,23 @@ module Zernio
|
|
|
342
416
|
if @api_client.config.client_side_validation && profile_id.nil?
|
|
343
417
|
fail ArgumentError, "Missing the required parameter 'profile_id' when calling ConnectApi.connect_ads"
|
|
344
418
|
end
|
|
419
|
+
allowable_values = ["classic", "business"]
|
|
420
|
+
if @api_client.config.client_side_validation && opts[:'login_mode'] && !allowable_values.include?(opts[:'login_mode'])
|
|
421
|
+
fail ArgumentError, "invalid value for \"login_mode\", must be one of #{allowable_values}"
|
|
422
|
+
end
|
|
423
|
+
pattern = Regexp.new(/^\d+$/)
|
|
424
|
+
if @api_client.config.client_side_validation && !opts[:'page_id'].nil? && opts[:'page_id'] !~ pattern
|
|
425
|
+
fail ArgumentError, "invalid value for 'opts[:\"page_id\"]' when calling ConnectApi.connect_ads, must conform to the pattern #{pattern}."
|
|
426
|
+
end
|
|
427
|
+
|
|
345
428
|
# resource path
|
|
346
429
|
local_var_path = '/v1/connect/{platform}/ads'.sub('{' + 'platform' + '}', CGI.escape(platform.to_s))
|
|
347
430
|
|
|
348
431
|
# query parameters
|
|
349
432
|
query_params = opts[:query_params] || {}
|
|
350
433
|
query_params[:'profileId'] = profile_id
|
|
434
|
+
query_params[:'loginMode'] = opts[:'login_mode'] if !opts[:'login_mode'].nil?
|
|
435
|
+
query_params[:'pageId'] = opts[:'page_id'] if !opts[:'page_id'].nil?
|
|
351
436
|
query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
|
|
352
437
|
query_params[:'redirect_url'] = opts[:'redirect_url'] if !opts[:'redirect_url'].nil?
|
|
353
438
|
query_params[:'headless'] = opts[:'headless'] if !opts[:'headless'].nil?
|
|
@@ -90,7 +90,7 @@ module Zernio
|
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
# Create a lead form
|
|
93
|
-
# Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
|
|
93
|
+
# Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (a facebook account or a metaads business-login account with a selected Page) (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
|
|
94
94
|
# @param create_lead_form_request [CreateLeadFormRequest]
|
|
95
95
|
# @param [Hash] opts the optional parameters
|
|
96
96
|
# @return [CreateLeadForm200Response]
|
|
@@ -100,7 +100,7 @@ module Zernio
|
|
|
100
100
|
end
|
|
101
101
|
|
|
102
102
|
# Create a lead form
|
|
103
|
-
# Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
|
|
103
|
+
# Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (a facebook account or a metaads business-login account with a selected Page) (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
|
|
104
104
|
# @param create_lead_form_request [CreateLeadFormRequest]
|
|
105
105
|
# @param [Hash] opts the optional parameters
|
|
106
106
|
# @return [Array<(CreateLeadForm200Response, Integer, Hash)>] CreateLeadForm200Response data, response status code and response headers
|
|
@@ -300,7 +300,7 @@ module Zernio
|
|
|
300
300
|
end
|
|
301
301
|
|
|
302
302
|
# List leads for a single form
|
|
303
|
-
# Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.
|
|
303
|
+
# Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read. Accepts a Facebook account or a metaads business-login account with leads_retrieval access to the form; the latter uses its system-user token without a posting parent.
|
|
304
304
|
# @param form_id [String]
|
|
305
305
|
# @param account_id [String]
|
|
306
306
|
# @param [Hash] opts the optional parameters
|
|
@@ -314,7 +314,7 @@ module Zernio
|
|
|
314
314
|
end
|
|
315
315
|
|
|
316
316
|
# List leads for a single form
|
|
317
|
-
# Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.
|
|
317
|
+
# Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read. Accepts a Facebook account or a metaads business-login account with leads_retrieval access to the form; the latter uses its system-user token without a posting parent.
|
|
318
318
|
# @param form_id [String]
|
|
319
319
|
# @param account_id [String]
|
|
320
320
|
# @param [Hash] opts the optional parameters
|
|
@@ -387,8 +387,8 @@ module Zernio
|
|
|
387
387
|
end
|
|
388
388
|
|
|
389
389
|
# List lead forms
|
|
390
|
-
# Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
|
|
391
|
-
# @param account_id [String] Connected
|
|
390
|
+
# Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page, including a Page selected on a metaads business-login connection. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
|
|
391
|
+
# @param account_id [String] Connected Facebook, Meta ads business-login or LinkedIn ads account ID.
|
|
392
392
|
# @param [Hash] opts the optional parameters
|
|
393
393
|
# @option opts [String] :ad_account_id LinkedIn only: the LinkedIn ad account id (used to resolve the owning organization). Required for LinkedIn.
|
|
394
394
|
# @option opts [Integer] :limit (default to 25)
|
|
@@ -400,8 +400,8 @@ module Zernio
|
|
|
400
400
|
end
|
|
401
401
|
|
|
402
402
|
# List lead forms
|
|
403
|
-
# Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
|
|
404
|
-
# @param account_id [String] Connected
|
|
403
|
+
# Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page, including a Page selected on a metaads business-login connection. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
|
|
404
|
+
# @param account_id [String] Connected Facebook, Meta ads business-login or LinkedIn ads account ID.
|
|
405
405
|
# @param [Hash] opts the optional parameters
|
|
406
406
|
# @option opts [String] :ad_account_id LinkedIn only: the LinkedIn ad account id (used to resolve the owning organization). Required for LinkedIn.
|
|
407
407
|
# @option opts [Integer] :limit (default to 25)
|
|
@@ -42,13 +42,13 @@ module Zernio
|
|
|
42
42
|
# Last time follower count was updated (only included if user has analytics add-on)
|
|
43
43
|
attr_accessor :followers_last_updated
|
|
44
44
|
|
|
45
|
-
# Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts.
|
|
45
|
+
# Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. Meta ads business-login accounts also have no parent.
|
|
46
46
|
attr_accessor :parent_account_id
|
|
47
47
|
|
|
48
48
|
# Whether the user explicitly activated this account. false means the account was created as a side effect (e.g., posting account auto-created when user connected ads first). Such accounts are hidden from this list, cannot be posted to (`ACCOUNT_NOT_ENABLED_FOR_POSTING`), and are not billed as connected accounts.
|
|
49
49
|
attr_accessor :enabled
|
|
50
50
|
|
|
51
|
-
# Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.
|
|
51
|
+
# Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For Meta ads business-login accounts: - tokenType: system-user - businessId: The owning Business Manager ID when there is one owner; null for multiple owners. - businessIds: Owning Business Manager IDs discovered from granted ad accounts. - grantedAdAccountIds: Ad-account IDs granted to the token. - adAccountBusinesses: Map from ad-account ID to its owning business ID or null. - availablePages: Granted Page IDs and names. No Page tokens are exposed. - selectedPageId: The Page selected for creatives and lead forms, or null. - scopedAdAccountIds: Existing sync scope preserved on reconnect. Non-expiring tokens have no tokenExpiresAt field. Parent posting reconnects do not replace this token. For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.
|
|
52
52
|
attr_accessor :metadata
|
|
53
53
|
|
|
54
54
|
# Current follower count
|
|
@@ -26,9 +26,34 @@ module Zernio
|
|
|
26
26
|
|
|
27
27
|
attr_accessor :display_name
|
|
28
28
|
|
|
29
|
+
# Present for an existing business-login connection.
|
|
30
|
+
attr_accessor :token_type
|
|
31
|
+
|
|
29
32
|
# Echo of the persisted ad-account scope when the caller passed `adAccountId` / `adAccountIds`. Omitted when no scope is set.
|
|
30
33
|
attr_accessor :scoped_ad_account_ids
|
|
31
34
|
|
|
35
|
+
class EnumAttributeValidator
|
|
36
|
+
attr_reader :datatype
|
|
37
|
+
attr_reader :allowable_values
|
|
38
|
+
|
|
39
|
+
def initialize(datatype, allowable_values)
|
|
40
|
+
@allowable_values = allowable_values.map do |value|
|
|
41
|
+
case datatype.to_s
|
|
42
|
+
when /Integer/i
|
|
43
|
+
value.to_i
|
|
44
|
+
when /Float/i
|
|
45
|
+
value.to_f
|
|
46
|
+
else
|
|
47
|
+
value
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def valid?(value)
|
|
53
|
+
!value || allowable_values.include?(value)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
32
57
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
33
58
|
def self.attribute_map
|
|
34
59
|
{
|
|
@@ -37,6 +62,7 @@ module Zernio
|
|
|
37
62
|
:'platform' => :'platform',
|
|
38
63
|
:'username' => :'username',
|
|
39
64
|
:'display_name' => :'displayName',
|
|
65
|
+
:'token_type' => :'tokenType',
|
|
40
66
|
:'scoped_ad_account_ids' => :'scopedAdAccountIds'
|
|
41
67
|
}
|
|
42
68
|
end
|
|
@@ -59,6 +85,7 @@ module Zernio
|
|
|
59
85
|
:'platform' => :'String',
|
|
60
86
|
:'username' => :'String',
|
|
61
87
|
:'display_name' => :'String',
|
|
88
|
+
:'token_type' => :'String',
|
|
62
89
|
:'scoped_ad_account_ids' => :'Array<String>'
|
|
63
90
|
}
|
|
64
91
|
end
|
|
@@ -105,6 +132,10 @@ module Zernio
|
|
|
105
132
|
self.display_name = attributes[:'display_name']
|
|
106
133
|
end
|
|
107
134
|
|
|
135
|
+
if attributes.key?(:'token_type')
|
|
136
|
+
self.token_type = attributes[:'token_type']
|
|
137
|
+
end
|
|
138
|
+
|
|
108
139
|
if attributes.key?(:'scoped_ad_account_ids')
|
|
109
140
|
if (value = attributes[:'scoped_ad_account_ids']).is_a?(Array)
|
|
110
141
|
self.scoped_ad_account_ids = value
|
|
@@ -124,9 +155,21 @@ module Zernio
|
|
|
124
155
|
# @return true if the model is valid
|
|
125
156
|
def valid?
|
|
126
157
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
158
|
+
token_type_validator = EnumAttributeValidator.new('String', ["system-user"])
|
|
159
|
+
return false unless token_type_validator.valid?(@token_type)
|
|
127
160
|
true
|
|
128
161
|
end
|
|
129
162
|
|
|
163
|
+
# Custom attribute writer method checking allowed values (enum).
|
|
164
|
+
# @param [Object] token_type Object to be assigned
|
|
165
|
+
def token_type=(token_type)
|
|
166
|
+
validator = EnumAttributeValidator.new('String', ["system-user"])
|
|
167
|
+
unless validator.valid?(token_type)
|
|
168
|
+
fail ArgumentError, "invalid value for \"token_type\", must be one of #{validator.allowable_values}."
|
|
169
|
+
end
|
|
170
|
+
@token_type = token_type
|
|
171
|
+
end
|
|
172
|
+
|
|
130
173
|
# Checks equality by comparing each attribute.
|
|
131
174
|
# @param [Object] Object to be compared
|
|
132
175
|
def ==(o)
|
|
@@ -137,6 +180,7 @@ module Zernio
|
|
|
137
180
|
platform == o.platform &&
|
|
138
181
|
username == o.username &&
|
|
139
182
|
display_name == o.display_name &&
|
|
183
|
+
token_type == o.token_type &&
|
|
140
184
|
scoped_ad_account_ids == o.scoped_ad_account_ids
|
|
141
185
|
end
|
|
142
186
|
|
|
@@ -149,7 +193,7 @@ module Zernio
|
|
|
149
193
|
# Calculates hash code according to all attributes.
|
|
150
194
|
# @return [Integer] Hash code
|
|
151
195
|
def hash
|
|
152
|
-
[already_connected, account_id, platform, username, display_name, scoped_ad_account_ids].hash
|
|
196
|
+
[already_connected, account_id, platform, username, display_name, token_type, scoped_ad_account_ids].hash
|
|
153
197
|
end
|
|
154
198
|
|
|
155
199
|
# Builds the object from hash
|
|
@@ -22,6 +22,12 @@ module Zernio
|
|
|
22
22
|
|
|
23
23
|
attr_accessor :currency
|
|
24
24
|
|
|
25
|
+
# Meta only. Owning Business Manager ID when available on the grant.
|
|
26
|
+
attr_accessor :business_id
|
|
27
|
+
|
|
28
|
+
# Owning business name when supplied by the platform.
|
|
29
|
+
attr_accessor :business_name
|
|
30
|
+
|
|
25
31
|
# LinkedIn only. LinkedIn's own ad account status. In practice always `ACTIVE`, because the LinkedIn query filters to active accounts. Meta, Google, TikTok and Pinterest report `accountStatus` instead; X reports `approvalStatus`.
|
|
26
32
|
attr_accessor :status
|
|
27
33
|
|
|
@@ -54,6 +60,8 @@ module Zernio
|
|
|
54
60
|
:'id' => :'id',
|
|
55
61
|
:'name' => :'name',
|
|
56
62
|
:'currency' => :'currency',
|
|
63
|
+
:'business_id' => :'businessId',
|
|
64
|
+
:'business_name' => :'businessName',
|
|
57
65
|
:'status' => :'status',
|
|
58
66
|
:'account_status' => :'accountStatus',
|
|
59
67
|
:'approval_status' => :'approvalStatus',
|
|
@@ -82,6 +90,8 @@ module Zernio
|
|
|
82
90
|
:'id' => :'String',
|
|
83
91
|
:'name' => :'String',
|
|
84
92
|
:'currency' => :'String',
|
|
93
|
+
:'business_id' => :'String',
|
|
94
|
+
:'business_name' => :'String',
|
|
85
95
|
:'status' => :'String',
|
|
86
96
|
:'account_status' => :'Object',
|
|
87
97
|
:'approval_status' => :'String',
|
|
@@ -130,6 +140,14 @@ module Zernio
|
|
|
130
140
|
self.currency = attributes[:'currency']
|
|
131
141
|
end
|
|
132
142
|
|
|
143
|
+
if attributes.key?(:'business_id')
|
|
144
|
+
self.business_id = attributes[:'business_id']
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
if attributes.key?(:'business_name')
|
|
148
|
+
self.business_name = attributes[:'business_name']
|
|
149
|
+
end
|
|
150
|
+
|
|
133
151
|
if attributes.key?(:'status')
|
|
134
152
|
self.status = attributes[:'status']
|
|
135
153
|
end
|
|
@@ -190,6 +208,8 @@ module Zernio
|
|
|
190
208
|
id == o.id &&
|
|
191
209
|
name == o.name &&
|
|
192
210
|
currency == o.currency &&
|
|
211
|
+
business_id == o.business_id &&
|
|
212
|
+
business_name == o.business_name &&
|
|
193
213
|
status == o.status &&
|
|
194
214
|
account_status == o.account_status &&
|
|
195
215
|
approval_status == o.approval_status &&
|
|
@@ -210,7 +230,7 @@ module Zernio
|
|
|
210
230
|
# Calculates hash code according to all attributes.
|
|
211
231
|
# @return [Integer] Hash code
|
|
212
232
|
def hash
|
|
213
|
-
[id, name, currency, status, account_status, approval_status, disable_reason, timezone_name, timezone_offset_hours_utc, minimum_daily_budget, selectable, unusable_reason].hash
|
|
233
|
+
[id, name, currency, business_id, business_name, status, account_status, approval_status, disable_reason, timezone_name, timezone_offset_hours_utc, minimum_daily_budget, selectable, unusable_reason].hash
|
|
214
234
|
end
|
|
215
235
|
|
|
216
236
|
# Builds the object from hash
|
|
@@ -42,13 +42,13 @@ module Zernio
|
|
|
42
42
|
# Last time follower count was updated (only included if user has analytics add-on)
|
|
43
43
|
attr_accessor :followers_last_updated
|
|
44
44
|
|
|
45
|
-
# Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts.
|
|
45
|
+
# Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. Meta ads business-login accounts also have no parent.
|
|
46
46
|
attr_accessor :parent_account_id
|
|
47
47
|
|
|
48
48
|
# Whether the user explicitly activated this account. false means the account was created as a side effect (e.g., posting account auto-created when user connected ads first). Such accounts are hidden from this list, cannot be posted to (`ACCOUNT_NOT_ENABLED_FOR_POSTING`), and are not billed as connected accounts.
|
|
49
49
|
attr_accessor :enabled
|
|
50
50
|
|
|
51
|
-
# Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.
|
|
51
|
+
# Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For Meta ads business-login accounts: - tokenType: system-user - businessId: The owning Business Manager ID when there is one owner; null for multiple owners. - businessIds: Owning Business Manager IDs discovered from granted ad accounts. - grantedAdAccountIds: Ad-account IDs granted to the token. - adAccountBusinesses: Map from ad-account ID to its owning business ID or null. - availablePages: Granted Page IDs and names. No Page tokens are exposed. - selectedPageId: The Page selected for creatives and lead forms, or null. - scopedAdAccountIds: Existing sync scope preserved on reconnect. Non-expiring tokens have no tokenExpiresAt field. Parent posting reconnects do not replace this token. For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.
|
|
52
52
|
attr_accessor :metadata
|
|
53
53
|
|
|
54
54
|
class EnumAttributeValidator
|
data/lib/zernio-sdk/version.rb
CHANGED
data/openapi.yaml
CHANGED
|
@@ -7189,7 +7189,7 @@ components:
|
|
|
7189
7189
|
description: |
|
|
7190
7190
|
Reference to the parent posting SocialAccount. Set for ads accounts that share
|
|
7191
7191
|
or derive from a posting account's OAuth token. null for standalone ads (Google Ads)
|
|
7192
|
-
and all posting accounts.
|
|
7192
|
+
and all posting accounts. Meta ads business-login accounts also have no parent.
|
|
7193
7193
|
enabled:
|
|
7194
7194
|
type: boolean
|
|
7195
7195
|
description: |
|
|
@@ -7209,6 +7209,17 @@ components:
|
|
|
7209
7209
|
- wabaId: WhatsApp Business Account ID
|
|
7210
7210
|
- phoneNumberId: Meta phone number ID
|
|
7211
7211
|
|
|
7212
|
+
For Meta ads business-login accounts:
|
|
7213
|
+
- tokenType: system-user
|
|
7214
|
+
- businessId: The owning Business Manager ID when there is one owner; null for multiple owners.
|
|
7215
|
+
- businessIds: Owning Business Manager IDs discovered from granted ad accounts.
|
|
7216
|
+
- grantedAdAccountIds: Ad-account IDs granted to the token.
|
|
7217
|
+
- adAccountBusinesses: Map from ad-account ID to its owning business ID or null.
|
|
7218
|
+
- availablePages: Granted Page IDs and names. No Page tokens are exposed.
|
|
7219
|
+
- selectedPageId: The Page selected for creatives and lead forms, or null.
|
|
7220
|
+
- scopedAdAccountIds: Existing sync scope preserved on reconnect.
|
|
7221
|
+
Non-expiring tokens have no tokenExpiresAt field. Parent posting reconnects do not replace this token.
|
|
7222
|
+
|
|
7212
7223
|
For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot:
|
|
7213
7224
|
- profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one.
|
|
7214
7225
|
- profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.
|
|
@@ -19491,10 +19502,31 @@ paths:
|
|
|
19491
19502
|
x-resource-group: "accounts"
|
|
19492
19503
|
operationId: connectAds
|
|
19493
19504
|
tags: [Connect]
|
|
19505
|
+
x-platforms: [meta, linkedin, tiktok, twitter, pinterest, google]
|
|
19494
19506
|
summary: Connect ads for a platform
|
|
19495
19507
|
description: |
|
|
19496
19508
|
Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform.
|
|
19497
19509
|
|
|
19510
|
+
**Meta business login (opt-in).** Set `loginMode=business` for `facebook` or
|
|
19511
|
+
`instagram` to use Facebook Login for Business and a Business Integration System User
|
|
19512
|
+
token. No posting account is created or required. This mode always returns an authUrl;
|
|
19513
|
+
it returns 503 when the server has no META_ADS_CONFIG_ID. Complete the dialog in a
|
|
19514
|
+
browser. The callback creates or reconnects only the metaads account, preserving its
|
|
19515
|
+
ID, history and scopedAdAccountIds. Non-empty successful subscription results replace
|
|
19516
|
+
subscribedAdAccountIds to remove stale grants; an empty result leaves routing unchanged. A reconnect must grant
|
|
19517
|
+
every previously scoped ad account (or every previous grant for an unscoped connection).
|
|
19518
|
+
Missing or unverifiable grants return 409 before changing the account.
|
|
19519
|
+
|
|
19520
|
+
Pass `pageId` to select a granted Page for creatives and lead forms. Otherwise the
|
|
19521
|
+
previous Page or sole granted Page is selected. Multiple Pages without a selection
|
|
19522
|
+
return 400 with available Page IDs; restart with pageId. With no Pages granted the
|
|
19523
|
+
account can manage campaigns and sync insights but cannot create Page-based creatives
|
|
19524
|
+
or list Page forms. Success redirects with connected=metaads, profileId and accountId.
|
|
19525
|
+
Business login reports metadata.tokenType=system-user in GET /v1/accounts. An absent
|
|
19526
|
+
Meta expires_in leaves tokenExpiresAt absent; no personal-token re-exchange occurs.
|
|
19527
|
+
Subsequent classic requests can change the ad-account scope using the business token;
|
|
19528
|
+
force=true requires loginMode=business to reconnect that connection.
|
|
19529
|
+
|
|
19498
19530
|
**Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount
|
|
19499
19531
|
(metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account,
|
|
19500
19532
|
but only when an active parent exists and, for facebook and instagram, its stored token
|
|
@@ -19527,6 +19559,16 @@ paths:
|
|
|
19527
19559
|
|
|
19528
19560
|
Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
19529
19561
|
parameters:
|
|
19562
|
+
- name: loginMode
|
|
19563
|
+
in: query
|
|
19564
|
+
schema: { type: string, enum: [classic, business], default: classic }
|
|
19565
|
+
description: "Meta ads authorization mode. Business login is opt-in for Facebook and Instagram; classic preserves the posting-account flow."
|
|
19566
|
+
example: business
|
|
19567
|
+
- name: pageId
|
|
19568
|
+
in: query
|
|
19569
|
+
schema: { type: string, pattern: '^\d+$' }
|
|
19570
|
+
description: "Business login only. Facebook Page ID to select from the token grants for ad creatives and lead forms."
|
|
19571
|
+
example: "811889972008357"
|
|
19530
19572
|
- name: platform
|
|
19531
19573
|
in: path
|
|
19532
19574
|
required: true
|
|
@@ -19536,7 +19578,7 @@ paths:
|
|
|
19536
19578
|
description: |
|
|
19537
19579
|
Platform to connect ads for. Only platforms with ads support are accepted.
|
|
19538
19580
|
|
|
19539
|
-
`instagram` requires an Instagram account connected with loginMethod=facebook_login whose
|
|
19581
|
+
In classic mode, `instagram` requires an Instagram account connected with loginMethod=facebook_login whose
|
|
19540
19582
|
token carries ads_management and ads_read. With an account connected through the default
|
|
19541
19583
|
instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
19542
19584
|
- name: profileId
|
|
@@ -19590,7 +19632,9 @@ paths:
|
|
|
19590
19632
|
schema: { type: string }
|
|
19591
19633
|
description: |
|
|
19592
19634
|
Scope ad sync to a single platform ad account. Without this param,
|
|
19593
|
-
sync covers every ad account the connected token can see.
|
|
19635
|
+
sync covers every ad account the connected token can see. Business-login reconnects
|
|
19636
|
+
preserve the existing scope; supplied IDs are checked against the new grant. To change
|
|
19637
|
+
that scope after migration, call this endpoint with the IDs and omit loginMode. Supported
|
|
19594
19638
|
on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare
|
|
19595
19639
|
numeric sponsored-account id), `googleads` (bare customer id digits)
|
|
19596
19640
|
and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers
|
|
@@ -19632,6 +19676,7 @@ paths:
|
|
|
19632
19676
|
platform: { type: string }
|
|
19633
19677
|
username: { type: string }
|
|
19634
19678
|
displayName: { type: string }
|
|
19679
|
+
tokenType: { type: string, enum: [system-user], description: "Present for an existing business-login connection." }
|
|
19635
19680
|
scopedAdAccountIds:
|
|
19636
19681
|
type: array
|
|
19637
19682
|
items: { type: string }
|
|
@@ -19653,6 +19698,11 @@ paths:
|
|
|
19653
19698
|
platform: "instagram"
|
|
19654
19699
|
username: "@mybrand"
|
|
19655
19700
|
displayName: "My Brand"
|
|
19701
|
+
businessLogin:
|
|
19702
|
+
summary: Meta ads business login
|
|
19703
|
+
value:
|
|
19704
|
+
authUrl: "https://www.facebook.com/v24.0/dialog/oauth?client_id=APP_ID&config_id=CONFIG_ID&response_type=code&override_default_response_type=true&redirect_uri=https%3A%2F%2Fzernio.com%2Fapi%2Fv1%2Fconnect%2Fmeta-ads%2Fcallback&state=ENCRYPTED_STATE"
|
|
19705
|
+
state: "ENCRYPTED_STATE"
|
|
19656
19706
|
oauthRequired:
|
|
19657
19707
|
summary: Separate-token platform (TikTok) needing ads OAuth
|
|
19658
19708
|
value:
|
|
@@ -19665,6 +19715,35 @@ paths:
|
|
|
19665
19715
|
description: "Ads access required (Ads add-on on legacy plans, included on usage-based plans), or no access to profile"
|
|
19666
19716
|
'404':
|
|
19667
19717
|
description: "Profile or posting account not found"
|
|
19718
|
+
'409':
|
|
19719
|
+
description: "Reconnect a system-user connection with loginMode=business."
|
|
19720
|
+
'503':
|
|
19721
|
+
description: "Business login is not configured or the platform is temporarily unavailable."
|
|
19722
|
+
|
|
19723
|
+
/v1/connect/meta-ads/callback:
|
|
19724
|
+
get:
|
|
19725
|
+
operationId: completeMetaAdsBusinessLogin
|
|
19726
|
+
summary: Complete Meta business login
|
|
19727
|
+
tags: [Connect]
|
|
19728
|
+
x-platforms: [meta]
|
|
19729
|
+
x-resource-group: "accounts"
|
|
19730
|
+
security: []
|
|
19731
|
+
description: "Facebook Login for Business redirect target. Meta supplies the single-use authorization code and the authenticated state returned by connectAds. The state expires after 30 minutes and binds the user, profile, Page selection and ad-account scope. No bearer token is sent by the browser. Success reconnects only metaads and redirects to the original redirect_url. Invalid state returns 400; inaccessible profiles or missing ads access cannot connect. No token is returned to the browser."
|
|
19732
|
+
parameters:
|
|
19733
|
+
- { name: state, in: query, required: true, schema: { type: string }, description: "Authenticated state from the initial connectAds response.", example: "ENCRYPTED_STATE" }
|
|
19734
|
+
- { name: code, in: query, schema: { type: string }, description: "Single-use authorization code returned by Meta." }
|
|
19735
|
+
- { name: error, in: query, schema: { type: string }, description: "Meta authorization error when the user declines the dialog." }
|
|
19736
|
+
responses:
|
|
19737
|
+
'307':
|
|
19738
|
+
description: "Redirect to the original callback URL with connected=metaads, profileId and accountId on success; authorization denial redirects with an error."
|
|
19739
|
+
headers:
|
|
19740
|
+
Location:
|
|
19741
|
+
schema: { type: string, format: uri }
|
|
19742
|
+
example: "https://example.com/callback?connected=metaads&profileId=PROFILE_ID&accountId=ACCOUNT_ID"
|
|
19743
|
+
'400': { $ref: '#/components/responses/BadRequest' }
|
|
19744
|
+
'403': { description: "Ads access or profile access required." }
|
|
19745
|
+
'409': { description: "The new token grants do not match the existing connection, or its previous grants cannot be verified." }
|
|
19746
|
+
'503': { description: "Business login state signing is not configured." }
|
|
19668
19747
|
|
|
19669
19748
|
/v1/connect/shopify:
|
|
19670
19749
|
get:
|
|
@@ -49787,6 +49866,9 @@ paths:
|
|
|
49787
49866
|
description: |
|
|
49788
49867
|
Returns the platform ad accounts available for the given account (e.g. Meta ad
|
|
49789
49868
|
accounts, TikTok advertiser IDs, Google Ads customer IDs).
|
|
49869
|
+
Meta business-login accounts use their own system-user token. Fresh Meta discovery
|
|
49870
|
+
includes businessId and businessName from the owning Business Manager when available;
|
|
49871
|
+
cached entries gain these fields after the next discovery refresh.
|
|
49790
49872
|
|
|
49791
49873
|
For TikTok agencies: enumerates every advertiser under every Business Center the token
|
|
49792
49874
|
can read (paginated server-side), then chunks the lookup against TikTok's
|
|
@@ -49818,6 +49900,8 @@ paths:
|
|
|
49818
49900
|
id: { type: string, description: "Platform ad account ID (e.g. act_123)" }
|
|
49819
49901
|
name: { type: string }
|
|
49820
49902
|
currency: { type: string }
|
|
49903
|
+
businessId: { type: string, description: "Meta only. Owning Business Manager ID when available on the grant." }
|
|
49904
|
+
businessName: { type: string, description: "Owning business name when supplied by the platform." }
|
|
49821
49905
|
status: { type: string, description: "LinkedIn only. LinkedIn's own ad account status. In practice always `ACTIVE`, because the LinkedIn query filters to active accounts. Meta, Google, TikTok and Pinterest report `accountStatus` instead; X reports `approvalStatus`." }
|
|
49822
49906
|
accountStatus:
|
|
49823
49907
|
description: |
|
|
@@ -51612,11 +51696,11 @@ paths:
|
|
|
51612
51696
|
summary: List lead forms
|
|
51613
51697
|
description: >
|
|
51614
51698
|
Lists the Lead Gen forms owned by the account. Meta: forms on the
|
|
51615
|
-
connected Facebook Page. LinkedIn: forms owned by the ad account's
|
|
51699
|
+
connected Facebook Page, including a Page selected on a metaads business-login connection. LinkedIn: forms owned by the ad account's
|
|
51616
51700
|
Company Page. Pass `adAccountId` (LinkedIn forms are org-owned).
|
|
51617
51701
|
Requires the Ads add-on.
|
|
51618
51702
|
parameters:
|
|
51619
|
-
- { name: accountId, in: query, required: true, schema: { type: string }, description: Connected
|
|
51703
|
+
- { name: accountId, in: query, required: true, schema: { type: string }, description: "Connected Facebook, Meta ads business-login or LinkedIn ads account ID." }
|
|
51620
51704
|
- { name: adAccountId, in: query, schema: { type: string }, description: "LinkedIn only: the LinkedIn ad account id (used to resolve the owning organization). Required for LinkedIn." }
|
|
51621
51705
|
- { name: limit, in: query, schema: { type: integer, minimum: 1, maximum: 100, default: 25 } }
|
|
51622
51706
|
- { name: cursor, in: query, schema: { type: string } }
|
|
@@ -51643,7 +51727,8 @@ paths:
|
|
|
51643
51727
|
description: >
|
|
51644
51728
|
Creates a Lead Gen form. The form content goes inside
|
|
51645
51729
|
`platformSpecificData` for both platforms (the shape is selected by the
|
|
51646
|
-
accountId's platform). Meta: created on the connected Facebook Page
|
|
51730
|
+
accountId's platform). Meta: created on the connected Facebook Page (a
|
|
51731
|
+
facebook account or a metaads business-login account with a selected Page)
|
|
51647
51732
|
(POST /{page-id}/leadgen_forms); the old top-level Meta fields
|
|
51648
51733
|
(questions, thankYou*, contextCard, …) are DEPRECATED but still
|
|
51649
51734
|
accepted while platformSpecificData is absent; mixing both shapes is
|
|
@@ -51837,6 +51922,8 @@ paths:
|
|
|
51837
51922
|
description: >
|
|
51838
51923
|
Returns leads for one form. Serves persisted leads (ingested via the
|
|
51839
51924
|
leadgen webhook) when available, falling back to a live Graph read.
|
|
51925
|
+
Accepts a Facebook account or a metaads business-login account with leads_retrieval
|
|
51926
|
+
access to the form; the latter uses its system-user token without a posting parent.
|
|
51840
51927
|
parameters:
|
|
51841
51928
|
- { name: formId, in: path, required: true, schema: { type: string } }
|
|
51842
51929
|
- { name: accountId, in: query, required: true, schema: { type: string } }
|
|
@@ -345,7 +345,7 @@ describe 'AdAccountsApi' do
|
|
|
345
345
|
|
|
346
346
|
# unit tests for list_ad_accounts
|
|
347
347
|
# List ad accounts
|
|
348
|
-
# Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
|
|
348
|
+
# Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). Meta business-login accounts use their own system-user token. Fresh Meta discovery includes businessId and businessName from the owning Business Manager when available; cached entries gain these fields after the next discovery refresh. For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
|
|
349
349
|
# @param account_id Account ID
|
|
350
350
|
# @param [Hash] opts the optional parameters
|
|
351
351
|
# @option opts [String] :ad_account_id Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.
|
|
@@ -45,6 +45,20 @@ describe 'ConnectApi' do
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
# unit tests for complete_meta_ads_business_login
|
|
49
|
+
# Complete Meta business login
|
|
50
|
+
# Facebook Login for Business redirect target. Meta supplies the single-use authorization code and the authenticated state returned by connectAds. The state expires after 30 minutes and binds the user, profile, Page selection and ad-account scope. No bearer token is sent by the browser. Success reconnects only metaads and redirects to the original redirect_url. Invalid state returns 400; inaccessible profiles or missing ads access cannot connect. No token is returned to the browser.
|
|
51
|
+
# @param state Authenticated state from the initial connectAds response.
|
|
52
|
+
# @param [Hash] opts the optional parameters
|
|
53
|
+
# @option opts [String] :code Single-use authorization code returned by Meta.
|
|
54
|
+
# @option opts [String] :error Meta authorization error when the user declines the dialog.
|
|
55
|
+
# @return [nil]
|
|
56
|
+
describe 'complete_meta_ads_business_login test' do
|
|
57
|
+
it 'should work' do
|
|
58
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
48
62
|
# unit tests for complete_telegram_connect
|
|
49
63
|
# Check Telegram status
|
|
50
64
|
# Poll this endpoint to check if a Telegram access code has been used to connect a channel/group. Recommended polling interval: 3 seconds. Status values: pending (waiting for user), connected (channel/group linked), expired (generate a new code).
|
|
@@ -84,15 +98,17 @@ describe 'ConnectApi' do
|
|
|
84
98
|
|
|
85
99
|
# unit tests for connect_ads
|
|
86
100
|
# Connect ads for a platform
|
|
87
|
-
# Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
88
|
-
# @param platform Platform to connect ads for. Only platforms with ads support are accepted. `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
101
|
+
# Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Meta business login (opt-in).** Set `loginMode=business` for `facebook` or `instagram` to use Facebook Login for Business and a Business Integration System User token. No posting account is created or required. This mode always returns an authUrl; it returns 503 when the server has no META_ADS_CONFIG_ID. Complete the dialog in a browser. The callback creates or reconnects only the metaads account, preserving its ID, history and scopedAdAccountIds. Non-empty successful subscription results replace subscribedAdAccountIds to remove stale grants; an empty result leaves routing unchanged. A reconnect must grant every previously scoped ad account (or every previous grant for an unscoped connection). Missing or unverifiable grants return 409 before changing the account. Pass `pageId` to select a granted Page for creatives and lead forms. Otherwise the previous Page or sole granted Page is selected. Multiple Pages without a selection return 400 with available Page IDs; restart with pageId. With no Pages granted the account can manage campaigns and sync insights but cannot create Page-based creatives or list Page forms. Success redirects with connected=metaads, profileId and accountId. Business login reports metadata.tokenType=system-user in GET /v1/accounts. An absent Meta expires_in leaves tokenExpiresAt absent; no personal-token re-exchange occurs. Subsequent classic requests can change the ad-account scope using the business token; force=true requires loginMode=business to reconnect that connection. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
|
|
102
|
+
# @param platform Platform to connect ads for. Only platforms with ads support are accepted. In classic mode, `instagram` requires an Instagram account connected with loginMethod=facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
|
|
89
103
|
# @param profile_id Your Zernio profile ID
|
|
90
104
|
# @param [Hash] opts the optional parameters
|
|
105
|
+
# @option opts [String] :login_mode Meta ads authorization mode. Business login is opt-in for Facebook and Instagram; classic preserves the posting-account flow.
|
|
106
|
+
# @option opts [String] :page_id Business login only. Facebook Page ID to select from the token grants for ad creatives and lead forms.
|
|
91
107
|
# @option opts [String] :account_id Existing SocialAccount ID. Required for `twitter` (X Ads). Optional for `tiktok`: omit to enter ads-only mode (no TikTok posting account linked; ad creation uses a Brand Identity instead of a TT_USER). Ignored for same-token (`facebook`, `instagram`, `linkedin`, `pinterest`) and standalone (`googleads`) platforms.
|
|
92
108
|
# @option opts [String] :redirect_url Custom URL the browser is sent to once the OAuth flow finishes. Honored on every ads platform, including the separate-token (`tiktok`, `twitter`) and standalone (`googleads`) flows. MUST be an absolute http(s) URL or a custom app scheme for mobile deeplinks (e.g. myapp://callback); a relative path is rejected with 400 INVALID_REDIRECT_URL. On success `tiktok`, `twitter` and `googleads` land on the URL unchanged, while the same-token platforms (`facebook`, `instagram`, `linkedin`, `pinterest`) append `connected`, `profileId`, `accountId`, `username` and, on API-key calls, `connect_token`. On failure the same error contract applies as on GET /v1/connect/{platform}: `error` and `platform` are always appended, other params are optional, and the value list there is not exhaustive. On the tiktok, twitter and googleads flows `platform` carries the ads platform id (`tiktokads`, `xads`, `googleads`), not the value used in the request path. When omitted, the browser lands on the Zernio dashboard.
|
|
93
109
|
# @option opts [Boolean] :headless Enable headless mode (same-token platforms only)
|
|
94
110
|
# @option opts [Boolean] :force Force a fresh OAuth even when an account already exists. Normally the endpoint returns `alreadyConnected: true` whenever a connected account is found, keying off its active state rather than token liveness. Set `force=true` to bypass that and always receivean `authUrl`. Completing the returned OAuth refreshes the stored token on the existing posting and ads accounts in place.
|
|
95
|
-
# @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead.
|
|
111
|
+
# @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Business-login reconnects preserve the existing scope; supplied IDs are checked against the new grant. To change that scope after migration, call this endpoint with the IDs and omit loginMode. Supported on `facebook`/`instagram` (Meta, `act_<digits>`), `linkedin` (bare numeric sponsored-account id), `googleads` (bare customer id digits) and `twitter` (X Ads, base36 account id). `tiktok` scopes advertisers at OAuth and `pinterest` has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use `adAccountIds` instead.
|
|
96
112
|
# @option opts [Array<String>] :ad_account_ids Scope ad sync to multiple platform ad accounts (same platform support and id shapes as `adAccountId`). Repeat the param (`?adAccountIds=act_1&adAccountIds=act_2`) or comma-separate (`?adAccountIds=act_1,act_2`). Persisted server-side; latest call wins, and de-scoped ad accounts have their synced ads removed. Omitting both `adAccountId` and `adAccountIds` keeps any previously persisted scope unchanged.
|
|
97
113
|
# @return [ConnectAds200Response]
|
|
98
114
|
describe 'connect_ads test' do
|
|
@@ -47,7 +47,7 @@ describe 'LeadGenApi' do
|
|
|
47
47
|
|
|
48
48
|
# unit tests for create_lead_form
|
|
49
49
|
# Create a lead form
|
|
50
|
-
# Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
|
|
50
|
+
# Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (a facebook account or a metaads business-login account with a selected Page) (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
|
|
51
51
|
# @param create_lead_form_request
|
|
52
52
|
# @param [Hash] opts the optional parameters
|
|
53
53
|
# @return [CreateLeadForm200Response]
|
|
@@ -84,7 +84,7 @@ describe 'LeadGenApi' do
|
|
|
84
84
|
|
|
85
85
|
# unit tests for list_form_leads
|
|
86
86
|
# List leads for a single form
|
|
87
|
-
# Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.
|
|
87
|
+
# Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read. Accepts a Facebook account or a metaads business-login account with leads_retrieval access to the form; the latter uses its system-user token without a posting parent.
|
|
88
88
|
# @param form_id
|
|
89
89
|
# @param account_id
|
|
90
90
|
# @param [Hash] opts the optional parameters
|
|
@@ -100,8 +100,8 @@ describe 'LeadGenApi' do
|
|
|
100
100
|
|
|
101
101
|
# unit tests for list_lead_forms
|
|
102
102
|
# List lead forms
|
|
103
|
-
# Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
|
|
104
|
-
# @param account_id Connected
|
|
103
|
+
# Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page, including a Page selected on a metaads business-login connection. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
|
|
104
|
+
# @param account_id Connected Facebook, Meta ads business-login or LinkedIn ads account ID.
|
|
105
105
|
# @param [Hash] opts the optional parameters
|
|
106
106
|
# @option opts [String] :ad_account_id LinkedIn only: the LinkedIn ad account id (used to resolve the owning organization). Required for LinkedIn.
|
|
107
107
|
# @option opts [Integer] :limit
|
|
@@ -57,6 +57,16 @@ describe Zernio::ConnectAds200ResponseOneOf do
|
|
|
57
57
|
end
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
+
describe 'test attribute "token_type"' do
|
|
61
|
+
it 'should work' do
|
|
62
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
63
|
+
# validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["system-user"])
|
|
64
|
+
# validator.allowable_values.each do |value|
|
|
65
|
+
# expect { instance.token_type = value }.not_to raise_error
|
|
66
|
+
# end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
60
70
|
describe 'test attribute "scoped_ad_account_ids"' do
|
|
61
71
|
it 'should work' do
|
|
62
72
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
@@ -45,6 +45,18 @@ describe Zernio::ListAdAccounts200ResponseAccountsInner do
|
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
+
describe 'test attribute "business_id"' do
|
|
49
|
+
it 'should work' do
|
|
50
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
describe 'test attribute "business_name"' do
|
|
55
|
+
it 'should work' do
|
|
56
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
48
60
|
describe 'test attribute "status"' do
|
|
49
61
|
it 'should work' do
|
|
50
62
|
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: late-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.908
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenAPI-Generator
|
|
@@ -6295,7 +6295,7 @@ files:
|
|
|
6295
6295
|
- spec/models/you_tube_video_retention_response_retention_curve_inner_spec.rb
|
|
6296
6296
|
- spec/models/you_tube_video_retention_response_spec.rb
|
|
6297
6297
|
- spec/spec_helper.rb
|
|
6298
|
-
- zernio-sdk-0.0.
|
|
6298
|
+
- zernio-sdk-0.0.908.gem
|
|
6299
6299
|
- zernio-sdk.gemspec
|
|
6300
6300
|
homepage: https://openapi-generator.tech
|
|
6301
6301
|
licenses:
|
data/zernio-sdk-0.0.906.gem
DELETED
|
Binary file
|