zernio-sdk 0.0.543 → 0.0.544
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 -1
- data/docs/WhatsAppApi.md +72 -0
- data/lib/zernio-sdk/api/whats_app_api.rb +70 -0
- data/lib/zernio-sdk/version.rb +1 -1
- data/lib/zernio-sdk.rb +0 -1
- data/openapi.yaml +1 -1
- data/spec/api/whats_app_api_spec.rb +13 -0
- metadata +1 -5
- data/docs/InboxApi.md +0 -79
- data/lib/zernio-sdk/api/inbox_api.rb +0 -92
- data/spec/api/inbox_api_spec.rb +0 -48
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1696279b128c04c6ecdd3a8e7db97b68cdc738ec46aa418f374d3ef58049285b
|
|
4
|
+
data.tar.gz: 13dc0f1c6b80ef71a4c9f8ec59ee3017bf5df69994c5eee5bcebb0b51ad4a19f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 680e23fc5681b43c12f4ad664536506dbe261b1b210b1f1b78a57ad8c7b08f434902ba9cb3cb9898c53a9fc260ea8e6a91d93d6086e8ddd129cf0ca969904c1d
|
|
7
|
+
data.tar.gz: bfe7774b76501dd4a0f315e0eceff1a8b53949c3dbb5674e5f5a75e4a2e25395c154f4532f071862d638d204a369cb85b6380e0edada5a3c704a572389921778
|
data/README.md
CHANGED
|
@@ -321,7 +321,6 @@ Class | Method | HTTP request | Description
|
|
|
321
321
|
*Zernio::GMBVerificationsApi* | [**fetch_google_business_verification_options**](docs/GMBVerificationsApi.md#fetch_google_business_verification_options) | **POST** /v1/accounts/{accountId}/gmb-verifications/options | Fetch verification options
|
|
322
322
|
*Zernio::GMBVerificationsApi* | [**get_google_business_verifications**](docs/GMBVerificationsApi.md#get_google_business_verifications) | **GET** /v1/accounts/{accountId}/gmb-verifications | Get verification state
|
|
323
323
|
*Zernio::GMBVerificationsApi* | [**start_google_business_verification**](docs/GMBVerificationsApi.md#start_google_business_verification) | **POST** /v1/accounts/{accountId}/gmb-verifications | Start a verification
|
|
324
|
-
*Zernio::InboxApi* | [**get_whats_app_media**](docs/InboxApi.md#get_whats_app_media) | **GET** /v1/whatsapp/media/{mediaId} | Download WhatsApp media
|
|
325
324
|
*Zernio::InboxAnalyticsApi* | [**get_inbox_conversation_analytics**](docs/InboxAnalyticsApi.md#get_inbox_conversation_analytics) | **GET** /v1/analytics/inbox/conversations/{conversationId} | Get conversation analytics
|
|
326
325
|
*Zernio::InboxAnalyticsApi* | [**get_inbox_heatmap**](docs/InboxAnalyticsApi.md#get_inbox_heatmap) | **GET** /v1/analytics/inbox/heatmap | Get day × hour heatmap
|
|
327
326
|
*Zernio::InboxAnalyticsApi* | [**get_inbox_response_time**](docs/InboxAnalyticsApi.md#get_inbox_response_time) | **GET** /v1/analytics/inbox/response-time | Get inbox response-time stats
|
|
@@ -488,6 +487,7 @@ Class | Method | HTTP request | Description
|
|
|
488
487
|
*Zernio::WhatsAppApi* | [**get_whats_app_dataset**](docs/WhatsAppApi.md#get_whats_app_dataset) | **GET** /v1/whatsapp/dataset | Get CTWA conversions dataset
|
|
489
488
|
*Zernio::WhatsAppApi* | [**get_whats_app_display_name**](docs/WhatsAppApi.md#get_whats_app_display_name) | **GET** /v1/whatsapp/business-profile/display-name | Get display name status
|
|
490
489
|
*Zernio::WhatsAppApi* | [**get_whats_app_group_chat**](docs/WhatsAppApi.md#get_whats_app_group_chat) | **GET** /v1/whatsapp/wa-groups/{groupId} | Get group info
|
|
490
|
+
*Zernio::WhatsAppApi* | [**get_whats_app_media**](docs/WhatsAppApi.md#get_whats_app_media) | **GET** /v1/whatsapp/media/{mediaId} | Download WhatsApp media
|
|
491
491
|
*Zernio::WhatsAppApi* | [**get_whats_app_template**](docs/WhatsAppApi.md#get_whats_app_template) | **GET** /v1/whatsapp/templates/{templateName} | Get template
|
|
492
492
|
*Zernio::WhatsAppApi* | [**get_whats_app_templates**](docs/WhatsAppApi.md#get_whats_app_templates) | **GET** /v1/whatsapp/templates | List templates
|
|
493
493
|
*Zernio::WhatsAppApi* | [**get_whatsapp_business_username**](docs/WhatsAppApi.md#get_whatsapp_business_username) | **GET** /v1/whatsapp/business-profile/username | Get business username
|
data/docs/WhatsAppApi.md
CHANGED
|
@@ -20,6 +20,7 @@ All URIs are relative to *https://zernio.com/api*
|
|
|
20
20
|
| [**get_whats_app_dataset**](WhatsAppApi.md#get_whats_app_dataset) | **GET** /v1/whatsapp/dataset | Get CTWA conversions dataset |
|
|
21
21
|
| [**get_whats_app_display_name**](WhatsAppApi.md#get_whats_app_display_name) | **GET** /v1/whatsapp/business-profile/display-name | Get display name status |
|
|
22
22
|
| [**get_whats_app_group_chat**](WhatsAppApi.md#get_whats_app_group_chat) | **GET** /v1/whatsapp/wa-groups/{groupId} | Get group info |
|
|
23
|
+
| [**get_whats_app_media**](WhatsAppApi.md#get_whats_app_media) | **GET** /v1/whatsapp/media/{mediaId} | Download WhatsApp media |
|
|
23
24
|
| [**get_whats_app_template**](WhatsAppApi.md#get_whats_app_template) | **GET** /v1/whatsapp/templates/{templateName} | Get template |
|
|
24
25
|
| [**get_whats_app_templates**](WhatsAppApi.md#get_whats_app_templates) | **GET** /v1/whatsapp/templates | List templates |
|
|
25
26
|
| [**get_whatsapp_business_username**](WhatsAppApi.md#get_whatsapp_business_username) | **GET** /v1/whatsapp/business-profile/username | Get business username |
|
|
@@ -1167,6 +1168,77 @@ end
|
|
|
1167
1168
|
- **Accept**: application/json
|
|
1168
1169
|
|
|
1169
1170
|
|
|
1171
|
+
## get_whats_app_media
|
|
1172
|
+
|
|
1173
|
+
> File get_whats_app_media(media_id, account_id)
|
|
1174
|
+
|
|
1175
|
+
Download WhatsApp media
|
|
1176
|
+
|
|
1177
|
+
Streams the binary for a WhatsApp attachment. This is the endpoint the `url` on a WhatsApp `attachments[]` entry points at, in both the `message.received` webhook and the List messages response. **This is an authenticated endpoint, not a public link.** Send `Authorization: Bearer <your API key>` exactly as you would for any other call. Passing the URL straight to a browser, an LLM vision API, or a no-code \"download file\" step without the header returns `401`. This is the most common integration mistake on this endpoint, and it differs from Instagram, Facebook and Telegram, whose `attachments[].url` is a direct CDN link that needs no header. **Fetch on receipt, not lazily.** WhatsApp media lives in Meta's media store, not ours, and it is removed after a limited retention window (currently 7 days, and Meta has been dropping some inbound media sooner). Once Meta drops it the media is unrecoverable and this endpoint answers `400` permanently, so retrying will never succeed. Download and store the bytes when the webhook arrives.
|
|
1178
|
+
|
|
1179
|
+
### Examples
|
|
1180
|
+
|
|
1181
|
+
```ruby
|
|
1182
|
+
require 'time'
|
|
1183
|
+
require 'zernio-sdk'
|
|
1184
|
+
# setup authorization
|
|
1185
|
+
Zernio.configure do |config|
|
|
1186
|
+
# Configure Bearer authorization (JWT): bearerAuth
|
|
1187
|
+
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
1188
|
+
end
|
|
1189
|
+
|
|
1190
|
+
api_instance = Zernio::WhatsAppApi.new
|
|
1191
|
+
media_id = 'media_id_example' # String | The media id from `attachments[].payload.id`.
|
|
1192
|
+
account_id = 'account_id_example' # String | The WhatsApp account that received the media.
|
|
1193
|
+
|
|
1194
|
+
begin
|
|
1195
|
+
# Download WhatsApp media
|
|
1196
|
+
result = api_instance.get_whats_app_media(media_id, account_id)
|
|
1197
|
+
p result
|
|
1198
|
+
rescue Zernio::ApiError => e
|
|
1199
|
+
puts "Error when calling WhatsAppApi->get_whats_app_media: #{e}"
|
|
1200
|
+
end
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
#### Using the get_whats_app_media_with_http_info variant
|
|
1204
|
+
|
|
1205
|
+
This returns an Array which contains the response data, status code and headers.
|
|
1206
|
+
|
|
1207
|
+
> <Array(File, Integer, Hash)> get_whats_app_media_with_http_info(media_id, account_id)
|
|
1208
|
+
|
|
1209
|
+
```ruby
|
|
1210
|
+
begin
|
|
1211
|
+
# Download WhatsApp media
|
|
1212
|
+
data, status_code, headers = api_instance.get_whats_app_media_with_http_info(media_id, account_id)
|
|
1213
|
+
p status_code # => 2xx
|
|
1214
|
+
p headers # => { ... }
|
|
1215
|
+
p data # => File
|
|
1216
|
+
rescue Zernio::ApiError => e
|
|
1217
|
+
puts "Error when calling WhatsAppApi->get_whats_app_media_with_http_info: #{e}"
|
|
1218
|
+
end
|
|
1219
|
+
```
|
|
1220
|
+
|
|
1221
|
+
### Parameters
|
|
1222
|
+
|
|
1223
|
+
| Name | Type | Description | Notes |
|
|
1224
|
+
| ---- | ---- | ----------- | ----- |
|
|
1225
|
+
| **media_id** | **String** | The media id from `attachments[].payload.id`. | |
|
|
1226
|
+
| **account_id** | **String** | The WhatsApp account that received the media. | |
|
|
1227
|
+
|
|
1228
|
+
### Return type
|
|
1229
|
+
|
|
1230
|
+
**File**
|
|
1231
|
+
|
|
1232
|
+
### Authorization
|
|
1233
|
+
|
|
1234
|
+
[bearerAuth](../README.md#bearerAuth)
|
|
1235
|
+
|
|
1236
|
+
### HTTP request headers
|
|
1237
|
+
|
|
1238
|
+
- **Content-Type**: Not defined
|
|
1239
|
+
- **Accept**: application/octet-stream, application/json
|
|
1240
|
+
|
|
1241
|
+
|
|
1170
1242
|
## get_whats_app_template
|
|
1171
1243
|
|
|
1172
1244
|
> <GetWhatsAppTemplate200Response> get_whats_app_template(template_name, account_id)
|
|
@@ -1142,6 +1142,76 @@ module Zernio
|
|
|
1142
1142
|
return data, status_code, headers
|
|
1143
1143
|
end
|
|
1144
1144
|
|
|
1145
|
+
# Download WhatsApp media
|
|
1146
|
+
# Streams the binary for a WhatsApp attachment. This is the endpoint the `url` on a WhatsApp `attachments[]` entry points at, in both the `message.received` webhook and the List messages response. **This is an authenticated endpoint, not a public link.** Send `Authorization: Bearer <your API key>` exactly as you would for any other call. Passing the URL straight to a browser, an LLM vision API, or a no-code \"download file\" step without the header returns `401`. This is the most common integration mistake on this endpoint, and it differs from Instagram, Facebook and Telegram, whose `attachments[].url` is a direct CDN link that needs no header. **Fetch on receipt, not lazily.** WhatsApp media lives in Meta's media store, not ours, and it is removed after a limited retention window (currently 7 days, and Meta has been dropping some inbound media sooner). Once Meta drops it the media is unrecoverable and this endpoint answers `400` permanently, so retrying will never succeed. Download and store the bytes when the webhook arrives.
|
|
1147
|
+
# @param media_id [String] The media id from `attachments[].payload.id`.
|
|
1148
|
+
# @param account_id [String] The WhatsApp account that received the media.
|
|
1149
|
+
# @param [Hash] opts the optional parameters
|
|
1150
|
+
# @return [File]
|
|
1151
|
+
def get_whats_app_media(media_id, account_id, opts = {})
|
|
1152
|
+
data, _status_code, _headers = get_whats_app_media_with_http_info(media_id, account_id, opts)
|
|
1153
|
+
data
|
|
1154
|
+
end
|
|
1155
|
+
|
|
1156
|
+
# Download WhatsApp media
|
|
1157
|
+
# Streams the binary for a WhatsApp attachment. This is the endpoint the `url` on a WhatsApp `attachments[]` entry points at, in both the `message.received` webhook and the List messages response. **This is an authenticated endpoint, not a public link.** Send `Authorization: Bearer <your API key>` exactly as you would for any other call. Passing the URL straight to a browser, an LLM vision API, or a no-code \"download file\" step without the header returns `401`. This is the most common integration mistake on this endpoint, and it differs from Instagram, Facebook and Telegram, whose `attachments[].url` is a direct CDN link that needs no header. **Fetch on receipt, not lazily.** WhatsApp media lives in Meta's media store, not ours, and it is removed after a limited retention window (currently 7 days, and Meta has been dropping some inbound media sooner). Once Meta drops it the media is unrecoverable and this endpoint answers `400` permanently, so retrying will never succeed. Download and store the bytes when the webhook arrives.
|
|
1158
|
+
# @param media_id [String] The media id from `attachments[].payload.id`.
|
|
1159
|
+
# @param account_id [String] The WhatsApp account that received the media.
|
|
1160
|
+
# @param [Hash] opts the optional parameters
|
|
1161
|
+
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
|
1162
|
+
def get_whats_app_media_with_http_info(media_id, account_id, opts = {})
|
|
1163
|
+
if @api_client.config.debugging
|
|
1164
|
+
@api_client.config.logger.debug 'Calling API: WhatsAppApi.get_whats_app_media ...'
|
|
1165
|
+
end
|
|
1166
|
+
# verify the required parameter 'media_id' is set
|
|
1167
|
+
if @api_client.config.client_side_validation && media_id.nil?
|
|
1168
|
+
fail ArgumentError, "Missing the required parameter 'media_id' when calling WhatsAppApi.get_whats_app_media"
|
|
1169
|
+
end
|
|
1170
|
+
# verify the required parameter 'account_id' is set
|
|
1171
|
+
if @api_client.config.client_side_validation && account_id.nil?
|
|
1172
|
+
fail ArgumentError, "Missing the required parameter 'account_id' when calling WhatsAppApi.get_whats_app_media"
|
|
1173
|
+
end
|
|
1174
|
+
# resource path
|
|
1175
|
+
local_var_path = '/v1/whatsapp/media/{mediaId}'.sub('{' + 'mediaId' + '}', CGI.escape(media_id.to_s))
|
|
1176
|
+
|
|
1177
|
+
# query parameters
|
|
1178
|
+
query_params = opts[:query_params] || {}
|
|
1179
|
+
query_params[:'accountId'] = account_id
|
|
1180
|
+
|
|
1181
|
+
# header parameters
|
|
1182
|
+
header_params = opts[:header_params] || {}
|
|
1183
|
+
# HTTP header 'Accept' (if needed)
|
|
1184
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) unless header_params['Accept']
|
|
1185
|
+
|
|
1186
|
+
# form parameters
|
|
1187
|
+
form_params = opts[:form_params] || {}
|
|
1188
|
+
|
|
1189
|
+
# http body (model)
|
|
1190
|
+
post_body = opts[:debug_body]
|
|
1191
|
+
|
|
1192
|
+
# return_type
|
|
1193
|
+
return_type = opts[:debug_return_type] || 'File'
|
|
1194
|
+
|
|
1195
|
+
# auth_names
|
|
1196
|
+
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
1197
|
+
|
|
1198
|
+
new_options = opts.merge(
|
|
1199
|
+
:operation => :"WhatsAppApi.get_whats_app_media",
|
|
1200
|
+
:header_params => header_params,
|
|
1201
|
+
:query_params => query_params,
|
|
1202
|
+
:form_params => form_params,
|
|
1203
|
+
:body => post_body,
|
|
1204
|
+
:auth_names => auth_names,
|
|
1205
|
+
:return_type => return_type
|
|
1206
|
+
)
|
|
1207
|
+
|
|
1208
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
1209
|
+
if @api_client.config.debugging
|
|
1210
|
+
@api_client.config.logger.debug "API called: WhatsAppApi#get_whats_app_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
1211
|
+
end
|
|
1212
|
+
return data, status_code, headers
|
|
1213
|
+
end
|
|
1214
|
+
|
|
1145
1215
|
# Get template
|
|
1146
1216
|
# Retrieve a single message template by name.
|
|
1147
1217
|
# @param template_name [String] Template name
|
data/lib/zernio-sdk/version.rb
CHANGED
data/lib/zernio-sdk.rb
CHANGED
|
@@ -1494,7 +1494,6 @@ require 'zernio-sdk/api/gmb_place_actions_api'
|
|
|
1494
1494
|
require 'zernio-sdk/api/gmb_reviews_api'
|
|
1495
1495
|
require 'zernio-sdk/api/gmb_services_api'
|
|
1496
1496
|
require 'zernio-sdk/api/gmb_verifications_api'
|
|
1497
|
-
require 'zernio-sdk/api/inbox_api'
|
|
1498
1497
|
require 'zernio-sdk/api/inbox_analytics_api'
|
|
1499
1498
|
require 'zernio-sdk/api/instagram_api'
|
|
1500
1499
|
require 'zernio-sdk/api/invites_api'
|
data/openapi.yaml
CHANGED
|
@@ -22627,7 +22627,7 @@ paths:
|
|
|
22627
22627
|
/v1/whatsapp/media/{mediaId}:
|
|
22628
22628
|
get:
|
|
22629
22629
|
operationId: getWhatsAppMedia
|
|
22630
|
-
tags: [
|
|
22630
|
+
tags: [WhatsApp]
|
|
22631
22631
|
summary: Download WhatsApp media
|
|
22632
22632
|
description: |
|
|
22633
22633
|
Streams the binary for a WhatsApp attachment. This is the endpoint the
|
|
@@ -235,6 +235,19 @@ describe 'WhatsAppApi' do
|
|
|
235
235
|
end
|
|
236
236
|
end
|
|
237
237
|
|
|
238
|
+
# unit tests for get_whats_app_media
|
|
239
|
+
# Download WhatsApp media
|
|
240
|
+
# Streams the binary for a WhatsApp attachment. This is the endpoint the `url` on a WhatsApp `attachments[]` entry points at, in both the `message.received` webhook and the List messages response. **This is an authenticated endpoint, not a public link.** Send `Authorization: Bearer <your API key>` exactly as you would for any other call. Passing the URL straight to a browser, an LLM vision API, or a no-code \"download file\" step without the header returns `401`. This is the most common integration mistake on this endpoint, and it differs from Instagram, Facebook and Telegram, whose `attachments[].url` is a direct CDN link that needs no header. **Fetch on receipt, not lazily.** WhatsApp media lives in Meta's media store, not ours, and it is removed after a limited retention window (currently 7 days, and Meta has been dropping some inbound media sooner). Once Meta drops it the media is unrecoverable and this endpoint answers `400` permanently, so retrying will never succeed. Download and store the bytes when the webhook arrives.
|
|
241
|
+
# @param media_id The media id from `attachments[].payload.id`.
|
|
242
|
+
# @param account_id The WhatsApp account that received the media.
|
|
243
|
+
# @param [Hash] opts the optional parameters
|
|
244
|
+
# @return [File]
|
|
245
|
+
describe 'get_whats_app_media test' do
|
|
246
|
+
it 'should work' do
|
|
247
|
+
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
248
|
+
end
|
|
249
|
+
end
|
|
250
|
+
|
|
238
251
|
# unit tests for get_whats_app_template
|
|
239
252
|
# Get template
|
|
240
253
|
# Retrieve a single message template by name.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zernio-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.544
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenAPI-Generator
|
|
@@ -775,7 +775,6 @@ files:
|
|
|
775
775
|
- docs/HideInboxComment200Response.md
|
|
776
776
|
- docs/HideInboxCommentRequest.md
|
|
777
777
|
- docs/InboxAnalyticsApi.md
|
|
778
|
-
- docs/InboxApi.md
|
|
779
778
|
- docs/InboxMessageEditAttachment.md
|
|
780
779
|
- docs/InboxMessageEditHistoryEntry.md
|
|
781
780
|
- docs/InboxWebhookAccount.md
|
|
@@ -1598,7 +1597,6 @@ files:
|
|
|
1598
1597
|
- lib/zernio-sdk/api/gmb_services_api.rb
|
|
1599
1598
|
- lib/zernio-sdk/api/gmb_verifications_api.rb
|
|
1600
1599
|
- lib/zernio-sdk/api/inbox_analytics_api.rb
|
|
1601
|
-
- lib/zernio-sdk/api/inbox_api.rb
|
|
1602
1600
|
- lib/zernio-sdk/api/instagram_api.rb
|
|
1603
1601
|
- lib/zernio-sdk/api/invites_api.rb
|
|
1604
1602
|
- lib/zernio-sdk/api/linked_in_mentions_api.rb
|
|
@@ -3112,7 +3110,6 @@ files:
|
|
|
3112
3110
|
- spec/api/gmb_services_api_spec.rb
|
|
3113
3111
|
- spec/api/gmb_verifications_api_spec.rb
|
|
3114
3112
|
- spec/api/inbox_analytics_api_spec.rb
|
|
3115
|
-
- spec/api/inbox_api_spec.rb
|
|
3116
3113
|
- spec/api/instagram_api_spec.rb
|
|
3117
3114
|
- spec/api/invites_api_spec.rb
|
|
3118
3115
|
- spec/api/linked_in_mentions_api_spec.rb
|
|
@@ -4649,7 +4646,6 @@ test_files:
|
|
|
4649
4646
|
- spec/api/comment_automations_api_spec.rb
|
|
4650
4647
|
- spec/api/webhooks_api_spec.rb
|
|
4651
4648
|
- spec/api/voice_api_spec.rb
|
|
4652
|
-
- spec/api/inbox_api_spec.rb
|
|
4653
4649
|
- spec/api/ads_api_spec.rb
|
|
4654
4650
|
- spec/api/verify_api_spec.rb
|
|
4655
4651
|
- spec/api/broadcasts_api_spec.rb
|
data/docs/InboxApi.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# Zernio::InboxApi
|
|
2
|
-
|
|
3
|
-
All URIs are relative to *https://zernio.com/api*
|
|
4
|
-
|
|
5
|
-
| Method | HTTP request | Description |
|
|
6
|
-
| ------ | ------------ | ----------- |
|
|
7
|
-
| [**get_whats_app_media**](InboxApi.md#get_whats_app_media) | **GET** /v1/whatsapp/media/{mediaId} | Download WhatsApp media |
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## get_whats_app_media
|
|
11
|
-
|
|
12
|
-
> File get_whats_app_media(media_id, account_id)
|
|
13
|
-
|
|
14
|
-
Download WhatsApp media
|
|
15
|
-
|
|
16
|
-
Streams the binary for a WhatsApp attachment. This is the endpoint the `url` on a WhatsApp `attachments[]` entry points at, in both the `message.received` webhook and the List messages response. **This is an authenticated endpoint, not a public link.** Send `Authorization: Bearer <your API key>` exactly as you would for any other call. Passing the URL straight to a browser, an LLM vision API, or a no-code \"download file\" step without the header returns `401`. This is the most common integration mistake on this endpoint, and it differs from Instagram, Facebook and Telegram, whose `attachments[].url` is a direct CDN link that needs no header. **Fetch on receipt, not lazily.** WhatsApp media lives in Meta's media store, not ours, and it is removed after a limited retention window (currently 7 days, and Meta has been dropping some inbound media sooner). Once Meta drops it the media is unrecoverable and this endpoint answers `400` permanently, so retrying will never succeed. Download and store the bytes when the webhook arrives.
|
|
17
|
-
|
|
18
|
-
### Examples
|
|
19
|
-
|
|
20
|
-
```ruby
|
|
21
|
-
require 'time'
|
|
22
|
-
require 'zernio-sdk'
|
|
23
|
-
# setup authorization
|
|
24
|
-
Zernio.configure do |config|
|
|
25
|
-
# Configure Bearer authorization (JWT): bearerAuth
|
|
26
|
-
config.access_token = 'YOUR_BEARER_TOKEN'
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
api_instance = Zernio::InboxApi.new
|
|
30
|
-
media_id = 'media_id_example' # String | The media id from `attachments[].payload.id`.
|
|
31
|
-
account_id = 'account_id_example' # String | The WhatsApp account that received the media.
|
|
32
|
-
|
|
33
|
-
begin
|
|
34
|
-
# Download WhatsApp media
|
|
35
|
-
result = api_instance.get_whats_app_media(media_id, account_id)
|
|
36
|
-
p result
|
|
37
|
-
rescue Zernio::ApiError => e
|
|
38
|
-
puts "Error when calling InboxApi->get_whats_app_media: #{e}"
|
|
39
|
-
end
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
#### Using the get_whats_app_media_with_http_info variant
|
|
43
|
-
|
|
44
|
-
This returns an Array which contains the response data, status code and headers.
|
|
45
|
-
|
|
46
|
-
> <Array(File, Integer, Hash)> get_whats_app_media_with_http_info(media_id, account_id)
|
|
47
|
-
|
|
48
|
-
```ruby
|
|
49
|
-
begin
|
|
50
|
-
# Download WhatsApp media
|
|
51
|
-
data, status_code, headers = api_instance.get_whats_app_media_with_http_info(media_id, account_id)
|
|
52
|
-
p status_code # => 2xx
|
|
53
|
-
p headers # => { ... }
|
|
54
|
-
p data # => File
|
|
55
|
-
rescue Zernio::ApiError => e
|
|
56
|
-
puts "Error when calling InboxApi->get_whats_app_media_with_http_info: #{e}"
|
|
57
|
-
end
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Parameters
|
|
61
|
-
|
|
62
|
-
| Name | Type | Description | Notes |
|
|
63
|
-
| ---- | ---- | ----------- | ----- |
|
|
64
|
-
| **media_id** | **String** | The media id from `attachments[].payload.id`. | |
|
|
65
|
-
| **account_id** | **String** | The WhatsApp account that received the media. | |
|
|
66
|
-
|
|
67
|
-
### Return type
|
|
68
|
-
|
|
69
|
-
**File**
|
|
70
|
-
|
|
71
|
-
### Authorization
|
|
72
|
-
|
|
73
|
-
[bearerAuth](../README.md#bearerAuth)
|
|
74
|
-
|
|
75
|
-
### HTTP request headers
|
|
76
|
-
|
|
77
|
-
- **Content-Type**: Not defined
|
|
78
|
-
- **Accept**: application/octet-stream, application/json
|
|
79
|
-
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#Zernio API
|
|
3
|
-
|
|
4
|
-
#API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.4
|
|
7
|
-
Contact: support@zernio.com
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.19.0
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'cgi'
|
|
14
|
-
|
|
15
|
-
module Zernio
|
|
16
|
-
class InboxApi
|
|
17
|
-
attr_accessor :api_client
|
|
18
|
-
|
|
19
|
-
def initialize(api_client = ApiClient.default)
|
|
20
|
-
@api_client = api_client
|
|
21
|
-
end
|
|
22
|
-
# Download WhatsApp media
|
|
23
|
-
# Streams the binary for a WhatsApp attachment. This is the endpoint the `url` on a WhatsApp `attachments[]` entry points at, in both the `message.received` webhook and the List messages response. **This is an authenticated endpoint, not a public link.** Send `Authorization: Bearer <your API key>` exactly as you would for any other call. Passing the URL straight to a browser, an LLM vision API, or a no-code \"download file\" step without the header returns `401`. This is the most common integration mistake on this endpoint, and it differs from Instagram, Facebook and Telegram, whose `attachments[].url` is a direct CDN link that needs no header. **Fetch on receipt, not lazily.** WhatsApp media lives in Meta's media store, not ours, and it is removed after a limited retention window (currently 7 days, and Meta has been dropping some inbound media sooner). Once Meta drops it the media is unrecoverable and this endpoint answers `400` permanently, so retrying will never succeed. Download and store the bytes when the webhook arrives.
|
|
24
|
-
# @param media_id [String] The media id from `attachments[].payload.id`.
|
|
25
|
-
# @param account_id [String] The WhatsApp account that received the media.
|
|
26
|
-
# @param [Hash] opts the optional parameters
|
|
27
|
-
# @return [File]
|
|
28
|
-
def get_whats_app_media(media_id, account_id, opts = {})
|
|
29
|
-
data, _status_code, _headers = get_whats_app_media_with_http_info(media_id, account_id, opts)
|
|
30
|
-
data
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Download WhatsApp media
|
|
34
|
-
# Streams the binary for a WhatsApp attachment. This is the endpoint the `url` on a WhatsApp `attachments[]` entry points at, in both the `message.received` webhook and the List messages response. **This is an authenticated endpoint, not a public link.** Send `Authorization: Bearer <your API key>` exactly as you would for any other call. Passing the URL straight to a browser, an LLM vision API, or a no-code \"download file\" step without the header returns `401`. This is the most common integration mistake on this endpoint, and it differs from Instagram, Facebook and Telegram, whose `attachments[].url` is a direct CDN link that needs no header. **Fetch on receipt, not lazily.** WhatsApp media lives in Meta's media store, not ours, and it is removed after a limited retention window (currently 7 days, and Meta has been dropping some inbound media sooner). Once Meta drops it the media is unrecoverable and this endpoint answers `400` permanently, so retrying will never succeed. Download and store the bytes when the webhook arrives.
|
|
35
|
-
# @param media_id [String] The media id from `attachments[].payload.id`.
|
|
36
|
-
# @param account_id [String] The WhatsApp account that received the media.
|
|
37
|
-
# @param [Hash] opts the optional parameters
|
|
38
|
-
# @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
|
|
39
|
-
def get_whats_app_media_with_http_info(media_id, account_id, opts = {})
|
|
40
|
-
if @api_client.config.debugging
|
|
41
|
-
@api_client.config.logger.debug 'Calling API: InboxApi.get_whats_app_media ...'
|
|
42
|
-
end
|
|
43
|
-
# verify the required parameter 'media_id' is set
|
|
44
|
-
if @api_client.config.client_side_validation && media_id.nil?
|
|
45
|
-
fail ArgumentError, "Missing the required parameter 'media_id' when calling InboxApi.get_whats_app_media"
|
|
46
|
-
end
|
|
47
|
-
# verify the required parameter 'account_id' is set
|
|
48
|
-
if @api_client.config.client_side_validation && account_id.nil?
|
|
49
|
-
fail ArgumentError, "Missing the required parameter 'account_id' when calling InboxApi.get_whats_app_media"
|
|
50
|
-
end
|
|
51
|
-
# resource path
|
|
52
|
-
local_var_path = '/v1/whatsapp/media/{mediaId}'.sub('{' + 'mediaId' + '}', CGI.escape(media_id.to_s))
|
|
53
|
-
|
|
54
|
-
# query parameters
|
|
55
|
-
query_params = opts[:query_params] || {}
|
|
56
|
-
query_params[:'accountId'] = account_id
|
|
57
|
-
|
|
58
|
-
# header parameters
|
|
59
|
-
header_params = opts[:header_params] || {}
|
|
60
|
-
# HTTP header 'Accept' (if needed)
|
|
61
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream', 'application/json']) unless header_params['Accept']
|
|
62
|
-
|
|
63
|
-
# form parameters
|
|
64
|
-
form_params = opts[:form_params] || {}
|
|
65
|
-
|
|
66
|
-
# http body (model)
|
|
67
|
-
post_body = opts[:debug_body]
|
|
68
|
-
|
|
69
|
-
# return_type
|
|
70
|
-
return_type = opts[:debug_return_type] || 'File'
|
|
71
|
-
|
|
72
|
-
# auth_names
|
|
73
|
-
auth_names = opts[:debug_auth_names] || ['bearerAuth']
|
|
74
|
-
|
|
75
|
-
new_options = opts.merge(
|
|
76
|
-
:operation => :"InboxApi.get_whats_app_media",
|
|
77
|
-
:header_params => header_params,
|
|
78
|
-
:query_params => query_params,
|
|
79
|
-
:form_params => form_params,
|
|
80
|
-
:body => post_body,
|
|
81
|
-
:auth_names => auth_names,
|
|
82
|
-
:return_type => return_type
|
|
83
|
-
)
|
|
84
|
-
|
|
85
|
-
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
86
|
-
if @api_client.config.debugging
|
|
87
|
-
@api_client.config.logger.debug "API called: InboxApi#get_whats_app_media\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
88
|
-
end
|
|
89
|
-
return data, status_code, headers
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
end
|
data/spec/api/inbox_api_spec.rb
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
=begin
|
|
2
|
-
#Zernio API
|
|
3
|
-
|
|
4
|
-
#API reference for Zernio. Authenticate with a Bearer API key. Base URL: https://zernio.com/api
|
|
5
|
-
|
|
6
|
-
The version of the OpenAPI document: 1.0.4
|
|
7
|
-
Contact: support@zernio.com
|
|
8
|
-
Generated by: https://openapi-generator.tech
|
|
9
|
-
Generator version: 7.19.0
|
|
10
|
-
|
|
11
|
-
=end
|
|
12
|
-
|
|
13
|
-
require 'spec_helper'
|
|
14
|
-
require 'json'
|
|
15
|
-
|
|
16
|
-
# Unit tests for Zernio::InboxApi
|
|
17
|
-
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
|
18
|
-
# Please update as you see appropriate
|
|
19
|
-
describe 'InboxApi' do
|
|
20
|
-
before do
|
|
21
|
-
# run before each test
|
|
22
|
-
@api_instance = Zernio::InboxApi.new
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
after do
|
|
26
|
-
# run after each test
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
describe 'test an instance of InboxApi' do
|
|
30
|
-
it 'should create an instance of InboxApi' do
|
|
31
|
-
expect(@api_instance).to be_instance_of(Zernio::InboxApi)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# unit tests for get_whats_app_media
|
|
36
|
-
# Download WhatsApp media
|
|
37
|
-
# Streams the binary for a WhatsApp attachment. This is the endpoint the `url` on a WhatsApp `attachments[]` entry points at, in both the `message.received` webhook and the List messages response. **This is an authenticated endpoint, not a public link.** Send `Authorization: Bearer <your API key>` exactly as you would for any other call. Passing the URL straight to a browser, an LLM vision API, or a no-code \"download file\" step without the header returns `401`. This is the most common integration mistake on this endpoint, and it differs from Instagram, Facebook and Telegram, whose `attachments[].url` is a direct CDN link that needs no header. **Fetch on receipt, not lazily.** WhatsApp media lives in Meta's media store, not ours, and it is removed after a limited retention window (currently 7 days, and Meta has been dropping some inbound media sooner). Once Meta drops it the media is unrecoverable and this endpoint answers `400` permanently, so retrying will never succeed. Download and store the bytes when the webhook arrives.
|
|
38
|
-
# @param media_id The media id from `attachments[].payload.id`.
|
|
39
|
-
# @param account_id The WhatsApp account that received the media.
|
|
40
|
-
# @param [Hash] opts the optional parameters
|
|
41
|
-
# @return [File]
|
|
42
|
-
describe 'get_whats_app_media test' do
|
|
43
|
-
it 'should work' do
|
|
44
|
-
# assertion here. ref: https://rspec.info/features/3-12/rspec-expectations/built-in-matchers/
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
end
|