Class: Zernio::MessagingAdsApi
- Inherits:
-
Object
- Object
- Zernio::MessagingAdsApi
- Defined in:
- lib/zernio-sdk/api/messaging_ads_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_call_ad(create_call_ad_request, opts = {}) ⇒ nil
Create Click-to-Call ad Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing
phoneNumbervia a tel: link. -
#create_call_ad_with_http_info(create_call_ad_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create Click-to-Call ad Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing `phoneNumber` via a tel: link.
-
#create_ctwa_ad(ctwa_ad_request_body, opts = {}) ⇒ CreateCtwaAd201Response
Create Click-to-WhatsApp ad (deprecated) Deprecated: use POST /v1/ads/messaging with
destination: whatsapp. -
#create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts = {}) ⇒ Array<(CreateCtwaAd201Response, Integer, Hash)>
Create Click-to-WhatsApp ad (deprecated) Deprecated: use POST /v1/ads/messaging with `destination: whatsapp`.
-
#create_messaging_ad(create_messaging_ad_request, opts = {}) ⇒ nil
Create click-to-message ad (WhatsApp / Messenger / Instagram Direct) Creates a click-to-message ad;
destinationselects where the tapped ad opens a conversation: WhatsApp, the Page's Messenger inbox or the linked Instagram account's Direct inbox. -
#create_messaging_ad_with_http_info(create_messaging_ad_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create click-to-message ad (WhatsApp / Messenger / Instagram Direct) Creates a click-to-message ad; `destination` selects where the tapped ad opens a conversation: WhatsApp, the Page's Messenger inbox or the linked Instagram account's Direct inbox.
-
#initialize(api_client = ApiClient.default) ⇒ MessagingAdsApi
constructor
A new instance of MessagingAdsApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ MessagingAdsApi
Returns a new instance of MessagingAdsApi.
19 20 21 |
# File 'lib/zernio-sdk/api/messaging_ads_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/zernio-sdk/api/messaging_ads_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_call_ad(create_call_ad_request, opts = {}) ⇒ nil
Create Click-to-Call ad
Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing phoneNumber via a tel: link. The ad set is destination_type PHONE_CALL optimizing QUALITY_CALL and the campaign objective defaults to OUTCOME_LEADS. Supports the same single-creative and multi-creative shapes as CTWA.
27 28 29 30 |
# File 'lib/zernio-sdk/api/messaging_ads_api.rb', line 27 def create_call_ad(create_call_ad_request, opts = {}) create_call_ad_with_http_info(create_call_ad_request, opts) nil end |
#create_call_ad_with_http_info(create_call_ad_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create Click-to-Call ad Same shape and flow as POST /v1/ads/ctwa, but the CTA is CALL_NOW dialing `phoneNumber` via a tel: link. The ad set is destination_type PHONE_CALL optimizing QUALITY_CALL and the campaign objective defaults to OUTCOME_LEADS. Supports the same single-creative and multi-creative shapes as CTWA.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/zernio-sdk/api/messaging_ads_api.rb', line 37 def create_call_ad_with_http_info(create_call_ad_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_call_ad ...' end # verify the required parameter 'create_call_ad_request' is set if @api_client.config.client_side_validation && create_call_ad_request.nil? fail ArgumentError, "Missing the required parameter 'create_call_ad_request' when calling MessagingAdsApi.create_call_ad" end # resource path local_var_path = '/v1/ads/call' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_call_ad_request) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"MessagingAdsApi.create_call_ad", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MessagingAdsApi#create_call_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_ctwa_ad(ctwa_ad_request_body, opts = {}) ⇒ CreateCtwaAd201Response
Create Click-to-WhatsApp ad (deprecated)
Deprecated: use POST /v1/ads/messaging with destination: whatsapp. This endpoint stays available for back-compat; no removal planned. Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - Single-creative: supply top-level headline, body, and one of imageUrl / video. Creates 1 campaign + 1 ad set + 1 ad. - Multi-creative: supply a creatives[] array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.
95 96 97 98 |
# File 'lib/zernio-sdk/api/messaging_ads_api.rb', line 95 def create_ctwa_ad(ctwa_ad_request_body, opts = {}) data, _status_code, _headers = create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts) data end |
#create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts = {}) ⇒ Array<(CreateCtwaAd201Response, Integer, Hash)>
Create Click-to-WhatsApp ad (deprecated) Deprecated: use POST /v1/ads/messaging with `destination: whatsapp`. This endpoint stays available for back-compat; no removal planned. Creates one or more Click-to-WhatsApp (CTWA) ads on Meta under a single campaign and ad set. When tapped, each ad opens a WhatsApp conversation with the business attached to the supplied Facebook Page. The full hierarchy (campaign, ad set, creative(s), ad(s)) is created and activated in one call. The CTA is locked to WHATSAPP_MESSAGE and the destination is hard-coded to api.whatsapp.com/send; Meta resolves the actual WhatsApp number from the Page-to-WA pairing configured in Page settings or Business Manager. Supports two mutually-exclusive shapes: - Single-creative: supply top-level `headline`, `body`, and one of `imageUrl` / `video`. Creates 1 campaign + 1 ad set + 1 ad. - Multi-creative: supply a `creatives` array with N entries (each carrying its own headline, body, and image/video). Creates 1 campaign + 1 ad set + N ads sharing budget and targeting so Meta A/Bs the creatives inside a single auction instead of fragmenting budget across N parallel campaigns. Recommended when launching multiple creative variants for the same campaign. Prerequisites enforced by Meta (surfaced as platform_error on failure): the Facebook Page must be paired with a verified WhatsApp Business number, the WhatsApp Business Account must be business-verified, and the Meta access token must carry ads_management.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/zernio-sdk/api/messaging_ads_api.rb', line 105 def create_ctwa_ad_with_http_info(ctwa_ad_request_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_ctwa_ad ...' end # verify the required parameter 'ctwa_ad_request_body' is set if @api_client.config.client_side_validation && ctwa_ad_request_body.nil? fail ArgumentError, "Missing the required parameter 'ctwa_ad_request_body' when calling MessagingAdsApi.create_ctwa_ad" end # resource path local_var_path = '/v1/ads/ctwa' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(ctwa_ad_request_body) # return_type return_type = opts[:debug_return_type] || 'CreateCtwaAd201Response' # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"MessagingAdsApi.create_ctwa_ad", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MessagingAdsApi#create_ctwa_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#create_messaging_ad(create_messaging_ad_request, opts = {}) ⇒ nil
Create click-to-message ad (WhatsApp / Messenger / Instagram Direct)
Creates a click-to-message ad; destination selects where the tapped ad opens a conversation: WhatsApp, the Page's Messenger inbox or the linked Instagram account's Direct inbox. The ad set is created with the matching destination_type and CONVERSATIONS optimization; the campaign objective defaults to OUTCOME_ENGAGEMENT. Supports single-creative and multi-creative shapes. Supersedes POST /v1/ads/ctwa (deprecated, equivalent to destination: whatsapp).
163 164 165 166 |
# File 'lib/zernio-sdk/api/messaging_ads_api.rb', line 163 def create_messaging_ad(create_messaging_ad_request, opts = {}) create_messaging_ad_with_http_info(create_messaging_ad_request, opts) nil end |
#create_messaging_ad_with_http_info(create_messaging_ad_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Create click-to-message ad (WhatsApp / Messenger / Instagram Direct) Creates a click-to-message ad; `destination` selects where the tapped ad opens a conversation: WhatsApp, the Page's Messenger inbox or the linked Instagram account's Direct inbox. The ad set is created with the matching destination_type and CONVERSATIONS optimization; the campaign objective defaults to OUTCOME_ENGAGEMENT. Supports single-creative and multi-creative shapes. Supersedes POST /v1/ads/ctwa (deprecated, equivalent to `destination: whatsapp`).
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/zernio-sdk/api/messaging_ads_api.rb', line 173 def create_messaging_ad_with_http_info(create_messaging_ad_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessagingAdsApi.create_messaging_ad ...' end # verify the required parameter 'create_messaging_ad_request' is set if @api_client.config.client_side_validation && create_messaging_ad_request.nil? fail ArgumentError, "Missing the required parameter 'create_messaging_ad_request' when calling MessagingAdsApi.create_messaging_ad" end # resource path local_var_path = '/v1/ads/messaging' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_messaging_ad_request) # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['bearerAuth'] = opts.merge( :operation => :"MessagingAdsApi.create_messaging_ad", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MessagingAdsApi#create_messaging_ad\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |