Class: Late::WhatsAppPhoneNumbersApi

Inherits:
Object
  • Object
show all
Defined in:
lib/late-sdk/api/whats_app_phone_numbers_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WhatsAppPhoneNumbersApi

Returns a new instance of WhatsAppPhoneNumbersApi.



19
20
21
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_preverified_whats_app_numbers(profile_id, opts = {}) ⇒ GetPreverifiedWhatsAppNumbers200Response

Get pre-verified numbers Returns the user’s pre-verified phone number IDs that are ready for OTP-free Embedded Signup. Only returns numbers with verified Meta status and non-expired verification.

Parameters:

  • profile_id (String)

    Profile ID to filter by

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



27
28
29
30
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 27

def get_preverified_whats_app_numbers(profile_id, opts = {})
  data, _status_code, _headers = get_preverified_whats_app_numbers_with_http_info(profile_id, opts)
  data
end

#get_preverified_whats_app_numbers_with_http_info(profile_id, opts = {}) ⇒ Array<(GetPreverifiedWhatsAppNumbers200Response, Integer, Hash)>

Get pre-verified numbers Returns the user&#39;s pre-verified phone number IDs that are ready for OTP-free Embedded Signup. Only returns numbers with verified Meta status and non-expired verification.

Parameters:

  • profile_id (String)

    Profile ID to filter by

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



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
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 37

def get_preverified_whats_app_numbers_with_http_info(profile_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.get_preverified_whats_app_numbers ...'
  end
  # verify the required parameter 'profile_id' is set
  if @api_client.config.client_side_validation && profile_id.nil?
    fail ArgumentError, "Missing the required parameter 'profile_id' when calling WhatsAppPhoneNumbersApi.get_preverified_whats_app_numbers"
  end
  # resource path
  local_var_path = '/v1/whatsapp/phone-numbers/preverified'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'profileId'] = profile_id

  # 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']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetPreverifiedWhatsAppNumbers200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WhatsAppPhoneNumbersApi.get_preverified_whats_app_numbers",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WhatsAppPhoneNumbersApi#get_preverified_whats_app_numbers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_whats_app_phone_number(phone_number_id, opts = {}) ⇒ GetWhatsAppPhoneNumber200Response

Get phone number Retrieve the current status of a purchased phone number. Used to poll for Meta pre-verification completion after purchase.

Parameters:

  • phone_number_id (String)

    Phone number record ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



91
92
93
94
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 91

def get_whats_app_phone_number(phone_number_id, opts = {})
  data, _status_code, _headers = get_whats_app_phone_number_with_http_info(phone_number_id, opts)
  data
end

#get_whats_app_phone_number_with_http_info(phone_number_id, opts = {}) ⇒ Array<(GetWhatsAppPhoneNumber200Response, Integer, Hash)>

Get phone number Retrieve the current status of a purchased phone number. Used to poll for Meta pre-verification completion after purchase.

Parameters:

  • phone_number_id (String)

    Phone number record ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



101
102
103
104
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
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 101

def get_whats_app_phone_number_with_http_info(phone_number_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.get_whats_app_phone_number ...'
  end
  # verify the required parameter 'phone_number_id' is set
  if @api_client.config.client_side_validation && phone_number_id.nil?
    fail ArgumentError, "Missing the required parameter 'phone_number_id' when calling WhatsAppPhoneNumbersApi.get_whats_app_phone_number"
  end
  # resource path
  local_var_path = '/v1/whatsapp/phone-numbers/{phoneNumberId}'.sub('{' + 'phoneNumberId' + '}', CGI.escape(phone_number_id.to_s))

  # 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']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetWhatsAppPhoneNumber200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WhatsAppPhoneNumbersApi.get_whats_app_phone_number",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WhatsAppPhoneNumbersApi#get_whats_app_phone_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_whats_app_phone_numbers(opts = {}) ⇒ GetWhatsAppPhoneNumbers200Response

List phone numbers List all WhatsApp phone numbers purchased by the authenticated user. By default, released numbers are excluded.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)

    Filter by status (by default excludes released numbers)

  • :profile_id (String)

    Filter by profile

Returns:



155
156
157
158
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 155

def get_whats_app_phone_numbers(opts = {})
  data, _status_code, _headers = get_whats_app_phone_numbers_with_http_info(opts)
  data
end

#get_whats_app_phone_numbers_with_http_info(opts = {}) ⇒ Array<(GetWhatsAppPhoneNumbers200Response, Integer, Hash)>

List phone numbers List all WhatsApp phone numbers purchased by the authenticated user. By default, released numbers are excluded.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :status (String)

    Filter by status (by default excludes released numbers)

  • :profile_id (String)

    Filter by profile

Returns:



166
167
168
169
170
171
172
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
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 166

def get_whats_app_phone_numbers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.get_whats_app_phone_numbers ...'
  end
  allowable_values = ["provisioning", "active", "suspended", "releasing", "released"]
  if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
    fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/whatsapp/phone-numbers'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?

  # 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']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'GetWhatsAppPhoneNumbers200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WhatsAppPhoneNumbersApi.get_whats_app_phone_numbers",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WhatsAppPhoneNumbersApi#get_whats_app_phone_numbers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#purchase_whats_app_phone_number(purchase_whats_app_phone_number_request, opts = {}) ⇒ PurchaseWhatsAppPhoneNumber200Response

Purchase phone number Initiate purchasing a WhatsApp phone number. Payment-first flow: the user does not pick a specific number. The system either creates a Stripe Checkout Session (first number) or increments the existing subscription quantity and provisions inline (subsequent numbers). Requires a paid plan. The maximum number of phone numbers is determined by the user’s plan.

Parameters:

Returns:



221
222
223
224
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 221

def purchase_whats_app_phone_number(purchase_whats_app_phone_number_request, opts = {})
  data, _status_code, _headers = purchase_whats_app_phone_number_with_http_info(purchase_whats_app_phone_number_request, opts)
  data
end

#purchase_whats_app_phone_number_with_http_info(purchase_whats_app_phone_number_request, opts = {}) ⇒ Array<(PurchaseWhatsAppPhoneNumber200Response, Integer, Hash)>

Purchase phone number Initiate purchasing a WhatsApp phone number. Payment-first flow: the user does not pick a specific number. The system either creates a Stripe Checkout Session (first number) or increments the existing subscription quantity and provisions inline (subsequent numbers). Requires a paid plan. The maximum number of phone numbers is determined by the user&#39;s plan.

Parameters:

Returns:



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 231

def purchase_whats_app_phone_number_with_http_info(purchase_whats_app_phone_number_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.purchase_whats_app_phone_number ...'
  end
  # verify the required parameter 'purchase_whats_app_phone_number_request' is set
  if @api_client.config.client_side_validation && purchase_whats_app_phone_number_request.nil?
    fail ArgumentError, "Missing the required parameter 'purchase_whats_app_phone_number_request' when calling WhatsAppPhoneNumbersApi.purchase_whats_app_phone_number"
  end
  # resource path
  local_var_path = '/v1/whatsapp/phone-numbers/purchase'

  # 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(purchase_whats_app_phone_number_request)

  # return_type
  return_type = opts[:debug_return_type] || 'PurchaseWhatsAppPhoneNumber200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WhatsAppPhoneNumbersApi.purchase_whats_app_phone_number",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WhatsAppPhoneNumbersApi#purchase_whats_app_phone_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#release_whats_app_phone_number(phone_number_id, opts = {}) ⇒ ReleaseWhatsAppPhoneNumber200Response

Release phone number Release a purchased phone number. This will: 1. Disconnect any linked WhatsApp social account 2. Decrement the Stripe subscription quantity (or cancel if last number) 3. Release the number from Telnyx 4. Mark the number as released

Parameters:

  • phone_number_id (String)

    Phone number record ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



289
290
291
292
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 289

def release_whats_app_phone_number(phone_number_id, opts = {})
  data, _status_code, _headers = release_whats_app_phone_number_with_http_info(phone_number_id, opts)
  data
end

#release_whats_app_phone_number_with_http_info(phone_number_id, opts = {}) ⇒ Array<(ReleaseWhatsAppPhoneNumber200Response, Integer, Hash)>

Release phone number Release a purchased phone number. This will: 1. Disconnect any linked WhatsApp social account 2. Decrement the Stripe subscription quantity (or cancel if last number) 3. Release the number from Telnyx 4. Mark the number as released

Parameters:

  • phone_number_id (String)

    Phone number record ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 299

def release_whats_app_phone_number_with_http_info(phone_number_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.release_whats_app_phone_number ...'
  end
  # verify the required parameter 'phone_number_id' is set
  if @api_client.config.client_side_validation && phone_number_id.nil?
    fail ArgumentError, "Missing the required parameter 'phone_number_id' when calling WhatsAppPhoneNumbersApi.release_whats_app_phone_number"
  end
  # resource path
  local_var_path = '/v1/whatsapp/phone-numbers/{phoneNumberId}'.sub('{' + 'phoneNumberId' + '}', CGI.escape(phone_number_id.to_s))

  # 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']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ReleaseWhatsAppPhoneNumber200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WhatsAppPhoneNumbersApi.release_whats_app_phone_number",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WhatsAppPhoneNumbersApi#release_whats_app_phone_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#request_whats_app_verification_code(phone_number_id, opts = {}) ⇒ RequestWhatsAppVerificationCode200Response

Request OTP Request a new OTP verification code from Meta for a pre-verified phone number. Useful when the initial SMS did not arrive or when re-verifying before the 90-day expiry.

Parameters:

  • phone_number_id (String)

    Phone number record ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



353
354
355
356
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 353

def request_whats_app_verification_code(phone_number_id, opts = {})
  data, _status_code, _headers = request_whats_app_verification_code_with_http_info(phone_number_id, opts)
  data
end

#request_whats_app_verification_code_with_http_info(phone_number_id, opts = {}) ⇒ Array<(RequestWhatsAppVerificationCode200Response, Integer, Hash)>

Request OTP Request a new OTP verification code from Meta for a pre-verified phone number. Useful when the initial SMS did not arrive or when re-verifying before the 90-day expiry.

Parameters:

  • phone_number_id (String)

    Phone number record ID

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 364

def request_whats_app_verification_code_with_http_info(phone_number_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.request_whats_app_verification_code ...'
  end
  # verify the required parameter 'phone_number_id' is set
  if @api_client.config.client_side_validation && phone_number_id.nil?
    fail ArgumentError, "Missing the required parameter 'phone_number_id' when calling WhatsAppPhoneNumbersApi.request_whats_app_verification_code"
  end
  # resource path
  local_var_path = '/v1/whatsapp/phone-numbers/{phoneNumberId}/request-code'.sub('{' + 'phoneNumberId' + '}', CGI.escape(phone_number_id.to_s))

  # 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(opts[:'request_whats_app_verification_code_request'])

  # return_type
  return_type = opts[:debug_return_type] || 'RequestWhatsAppVerificationCode200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WhatsAppPhoneNumbersApi.request_whats_app_verification_code",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WhatsAppPhoneNumbersApi#request_whats_app_verification_code\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_available_whats_app_numbers(opts = {}) ⇒ SearchAvailableWhatsAppNumbers200Response

Search available numbers Search for available US phone numbers that can be purchased for WhatsApp Business. Requires a paid plan. Numbers are sourced from Telnyx.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :prefix (String)

    Area code to search (e.g., &quot;212&quot; for New York)

  • :locality (String)

    City name (e.g., &quot;New York&quot;)

  • :contains (String)

    Pattern to match within the phone number

  • :limit (Integer)

    Maximum results (default 20, max 100) (default to 20)

Returns:



425
426
427
428
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 425

def search_available_whats_app_numbers(opts = {})
  data, _status_code, _headers = search_available_whats_app_numbers_with_http_info(opts)
  data
end

#search_available_whats_app_numbers_with_http_info(opts = {}) ⇒ Array<(SearchAvailableWhatsAppNumbers200Response, Integer, Hash)>

Search available numbers Search for available US phone numbers that can be purchased for WhatsApp Business. Requires a paid plan. Numbers are sourced from Telnyx.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :prefix (String)

    Area code to search (e.g., &quot;212&quot; for New York)

  • :locality (String)

    City name (e.g., &quot;New York&quot;)

  • :contains (String)

    Pattern to match within the phone number

  • :limit (Integer)

    Maximum results (default 20, max 100) (default to 20)

Returns:



438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 438

def search_available_whats_app_numbers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.search_available_whats_app_numbers ...'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WhatsAppPhoneNumbersApi.search_available_whats_app_numbers, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/v1/whatsapp/phone-numbers/available'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'prefix'] = opts[:'prefix'] if !opts[:'prefix'].nil?
  query_params[:'locality'] = opts[:'locality'] if !opts[:'locality'].nil?
  query_params[:'contains'] = opts[:'contains'] if !opts[:'contains'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # 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']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'SearchAvailableWhatsAppNumbers200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WhatsAppPhoneNumbersApi.search_available_whats_app_numbers",
    :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(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WhatsAppPhoneNumbersApi#search_available_whats_app_numbers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#verify_whats_app_phone_number(phone_number_id, verify_whats_app_phone_number_request, opts = {}) ⇒ VerifyWhatsAppPhoneNumber200Response

Verify OTP Manually verify a phone number by entering the OTP code received via SMS or voice call. This is a fallback for when the auto-verification webhook does not capture the code. Verification is valid for 90 days.

Parameters:

  • phone_number_id (String)

    Phone number record ID

  • verify_whats_app_phone_number_request (VerifyWhatsAppPhoneNumberRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



496
497
498
499
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 496

def verify_whats_app_phone_number(phone_number_id, verify_whats_app_phone_number_request, opts = {})
  data, _status_code, _headers = verify_whats_app_phone_number_with_http_info(phone_number_id, verify_whats_app_phone_number_request, opts)
  data
end

#verify_whats_app_phone_number_with_http_info(phone_number_id, verify_whats_app_phone_number_request, opts = {}) ⇒ Array<(VerifyWhatsAppPhoneNumber200Response, Integer, Hash)>

Verify OTP Manually verify a phone number by entering the OTP code received via SMS or voice call. This is a fallback for when the auto-verification webhook does not capture the code. Verification is valid for 90 days.

Parameters:

  • phone_number_id (String)

    Phone number record ID

  • verify_whats_app_phone_number_request (VerifyWhatsAppPhoneNumberRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
# File 'lib/late-sdk/api/whats_app_phone_numbers_api.rb', line 507

def verify_whats_app_phone_number_with_http_info(phone_number_id, verify_whats_app_phone_number_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WhatsAppPhoneNumbersApi.verify_whats_app_phone_number ...'
  end
  # verify the required parameter 'phone_number_id' is set
  if @api_client.config.client_side_validation && phone_number_id.nil?
    fail ArgumentError, "Missing the required parameter 'phone_number_id' when calling WhatsAppPhoneNumbersApi.verify_whats_app_phone_number"
  end
  # verify the required parameter 'verify_whats_app_phone_number_request' is set
  if @api_client.config.client_side_validation && verify_whats_app_phone_number_request.nil?
    fail ArgumentError, "Missing the required parameter 'verify_whats_app_phone_number_request' when calling WhatsAppPhoneNumbersApi.verify_whats_app_phone_number"
  end
  # resource path
  local_var_path = '/v1/whatsapp/phone-numbers/{phoneNumberId}/verify'.sub('{' + 'phoneNumberId' + '}', CGI.escape(phone_number_id.to_s))

  # 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(verify_whats_app_phone_number_request)

  # return_type
  return_type = opts[:debug_return_type] || 'VerifyWhatsAppPhoneNumber200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"WhatsAppPhoneNumbersApi.verify_whats_app_phone_number",
    :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, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WhatsAppPhoneNumbersApi#verify_whats_app_phone_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end