Class: Zernio::InboxAnalyticsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/inbox_analytics_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ InboxAnalyticsApi

Returns a new instance of InboxAnalyticsApi.



19
20
21
# File 'lib/zernio-sdk/api/inbox_analytics_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/zernio-sdk/api/inbox_analytics_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_inbox_conversation_analytics(conversation_id, from_date, opts = {}) ⇒ GetInboxConversationAnalytics200Response

Get conversation analytics Per-conversation inbox analytics. The inbox analog of /v1/analytics/post-timeline — one conversation, daily totals, source mix. The conversationId path param accepts EITHER the Mongo _id of the Conversation document OR its platformConversationId (the same identity used by metadata.conversationId at ingest time). Ownership is verified in MongoDB against the caller's team before the Tinybird query fires. Max date range is 365 days.

Parameters:

  • conversation_id (String)

    Mongo _id or platformConversationId.

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)

Returns:



29
30
31
32
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 29

def get_inbox_conversation_analytics(conversation_id, from_date, opts = {})
  data, _status_code, _headers = get_inbox_conversation_analytics_with_http_info(conversation_id, from_date, opts)
  data
end

#get_inbox_conversation_analytics_with_http_info(conversation_id, from_date, opts = {}) ⇒ Array<(GetInboxConversationAnalytics200Response, Integer, Hash)>

Get conversation analytics Per-conversation inbox analytics. The inbox analog of /v1/analytics/post-timeline — one conversation, daily totals, source mix. The conversationId path param accepts EITHER the Mongo `_id` of the Conversation document OR its `platformConversationId` (the same identity used by metadata.conversationId at ingest time). Ownership is verified in MongoDB against the caller's team before the Tinybird query fires. Max date range is 365 days.

Parameters:

  • conversation_id (String)

    Mongo _id or platformConversationId.

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)

Returns:



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
89
90
91
92
93
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 41

def get_inbox_conversation_analytics_with_http_info(conversation_id, from_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboxAnalyticsApi.get_inbox_conversation_analytics ...'
  end
  # verify the required parameter 'conversation_id' is set
  if @api_client.config.client_side_validation && conversation_id.nil?
    fail ArgumentError, "Missing the required parameter 'conversation_id' when calling InboxAnalyticsApi.get_inbox_conversation_analytics"
  end
  # verify the required parameter 'from_date' is set
  if @api_client.config.client_side_validation && from_date.nil?
    fail ArgumentError, "Missing the required parameter 'from_date' when calling InboxAnalyticsApi.get_inbox_conversation_analytics"
  end
  # resource path
  local_var_path = '/v1/analytics/inbox/conversations/{conversationId}'.sub('{' + 'conversationId' + '}', CGI.escape(conversation_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = from_date
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].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] || 'GetInboxConversationAnalytics200Response'

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

  new_options = opts.merge(
    :operation => :"InboxAnalyticsApi.get_inbox_conversation_analytics",
    :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: InboxAnalyticsApi#get_inbox_conversation_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_inbox_heatmap(from_date, opts = {}) ⇒ GetInboxHeatmap200Response

Get day × hour heatmap Day-of-week × hour-of-day breakdown of inbox messages. Buckets are sparse — only cells with at least one event are returned; clients zero-fill the rest to render the full 7×24 grid. The dow field follows ClickHouse's toDayOfWeek convention (1 = Monday … 7 = Sunday). Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :account_id (String)
  • :source (String)
  • :action (String)

    Narrow to a single event type. &quot;all&quot; or omitted means no filter.

Returns:



106
107
108
109
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 106

def get_inbox_heatmap(from_date, opts = {})
  data, _status_code, _headers = get_inbox_heatmap_with_http_info(from_date, opts)
  data
end

#get_inbox_heatmap_with_http_info(from_date, opts = {}) ⇒ Array<(GetInboxHeatmap200Response, Integer, Hash)>

Get day × hour heatmap Day-of-week × hour-of-day breakdown of inbox messages. Buckets are sparse — only cells with at least one event are returned; clients zero-fill the rest to render the full 7×24 grid. The `dow` field follows ClickHouse's `toDayOfWeek` convention (1 = Monday … 7 = Sunday). Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :account_id (String)
  • :source (String)
  • :action (String)

    Narrow to a single event type. &quot;all&quot; or omitted means no filter.

Returns:

  • (Array<(GetInboxHeatmap200Response, Integer, Hash)>)

    GetInboxHeatmap200Response data, response status code and response headers



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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 122

def get_inbox_heatmap_with_http_info(from_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboxAnalyticsApi.get_inbox_heatmap ...'
  end
  # verify the required parameter 'from_date' is set
  if @api_client.config.client_side_validation && from_date.nil?
    fail ArgumentError, "Missing the required parameter 'from_date' when calling InboxAnalyticsApi.get_inbox_heatmap"
  end
  allowable_values = ["message.received", "message.sent", "message.read", "all"]
  if @api_client.config.client_side_validation && opts[:'action'] && !allowable_values.include?(opts[:'action'])
    fail ArgumentError, "invalid value for \"action\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics/inbox/heatmap'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = from_date
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
  query_params[:'action'] = opts[:'action'] if !opts[:'action'].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] || 'GetInboxHeatmap200Response'

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

  new_options = opts.merge(
    :operation => :"InboxAnalyticsApi.get_inbox_heatmap",
    :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: InboxAnalyticsApi#get_inbox_heatmap\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_inbox_response_time(from_date, opts = {}) ⇒ GetInboxResponseTime200Response

Get inbox response-time stats Time-to-first-response stats. Pairs each received message with the next sent message in the same conversation and reports the delta as both summary statistics and a fixed-bucket histogram suited for the analytics page's TTR chart. sampleSize reflects only conversations that received AND got a reply in the window — received-but-never-answered conversations are excluded. Compare against /v1/analytics/inbox/volume's summary.received to compute reply rate. Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :account_id (String)

Returns:



190
191
192
193
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 190

def get_inbox_response_time(from_date, opts = {})
  data, _status_code, _headers = get_inbox_response_time_with_http_info(from_date, opts)
  data
end

#get_inbox_response_time_with_http_info(from_date, opts = {}) ⇒ Array<(GetInboxResponseTime200Response, Integer, Hash)>

Get inbox response-time stats Time-to-first-response stats. Pairs each received message with the next sent message in the same conversation and reports the delta as both summary statistics and a fixed-bucket histogram suited for the analytics page's TTR chart. `sampleSize` reflects only conversations that received AND got a reply in the window — received-but-never-answered conversations are excluded. Compare against /v1/analytics/inbox/volume's `summary.received` to compute reply rate. Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :account_id (String)

Returns:



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
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
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 204

def get_inbox_response_time_with_http_info(from_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboxAnalyticsApi.get_inbox_response_time ...'
  end
  # verify the required parameter 'from_date' is set
  if @api_client.config.client_side_validation && from_date.nil?
    fail ArgumentError, "Missing the required parameter 'from_date' when calling InboxAnalyticsApi.get_inbox_response_time"
  end
  # resource path
  local_var_path = '/v1/analytics/inbox/response-time'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = from_date
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_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] || 'GetInboxResponseTime200Response'

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

  new_options = opts.merge(
    :operation => :"InboxAnalyticsApi.get_inbox_response_time",
    :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: InboxAnalyticsApi#get_inbox_response_time\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_inbox_source_breakdown(from_date, opts = {}) ⇒ GetInboxSourceBreakdown200Response

Get inbox source breakdown Breakdown of inbox messages by their lineage source (the metadata.source field set at ingest time: human / workflow / sequence / broadcast / comment_automation / api / contact / platform). Each source row also carries a per-platform sub-split. Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :account_id (String)

Returns:



266
267
268
269
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 266

def get_inbox_source_breakdown(from_date, opts = {})
  data, _status_code, _headers = get_inbox_source_breakdown_with_http_info(from_date, opts)
  data
end

#get_inbox_source_breakdown_with_http_info(from_date, opts = {}) ⇒ Array<(GetInboxSourceBreakdown200Response, Integer, Hash)>

Get inbox source breakdown Breakdown of inbox messages by their lineage source (the `metadata.source` field set at ingest time: human / workflow / sequence / broadcast / comment_automation / api / contact / platform). Each source row also carries a per-platform sub-split. Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :account_id (String)

Returns:



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
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
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 280

def get_inbox_source_breakdown_with_http_info(from_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboxAnalyticsApi.get_inbox_source_breakdown ...'
  end
  # verify the required parameter 'from_date' is set
  if @api_client.config.client_side_validation && from_date.nil?
    fail ArgumentError, "Missing the required parameter 'from_date' when calling InboxAnalyticsApi.get_inbox_source_breakdown"
  end
  # resource path
  local_var_path = '/v1/analytics/inbox/source-breakdown'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = from_date
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_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] || 'GetInboxSourceBreakdown200Response'

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

  new_options = opts.merge(
    :operation => :"InboxAnalyticsApi.get_inbox_source_breakdown",
    :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: InboxAnalyticsApi#get_inbox_source_breakdown\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_inbox_top_accounts(from_date, opts = {}) ⇒ GetInboxTopAccounts200Response

Get top accounts by inbox volume Leaderboard of social accounts by inbox message volume. Decorates each row with display labels from the live SocialAccount record (so the UI shows username + displayName, not just an ID). Accounts that no longer map to a SocialAccount surface as "(disconnected)" so the row stays visible. Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :source (String)
  • :limit (Integer)

    Cap on returned rows. Lower than the posting listing's 100 because each row triggers a SocialAccount Mongo lookup. (default to 10)

Returns:



343
344
345
346
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 343

def get_inbox_top_accounts(from_date, opts = {})
  data, _status_code, _headers = get_inbox_top_accounts_with_http_info(from_date, opts)
  data
end

#get_inbox_top_accounts_with_http_info(from_date, opts = {}) ⇒ Array<(GetInboxTopAccounts200Response, Integer, Hash)>

Get top accounts by inbox volume Leaderboard of social accounts by inbox message volume. Decorates each row with display labels from the live SocialAccount record (so the UI shows username + displayName, not just an ID). Accounts that no longer map to a SocialAccount surface as &quot;(disconnected)&quot; so the row stays visible. Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :source (String)
  • :limit (Integer)

    Cap on returned rows. Lower than the posting listing's 100 because each row triggers a SocialAccount Mongo lookup. (default to 10)

Returns:



358
359
360
361
362
363
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
416
417
418
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 358

def get_inbox_top_accounts_with_http_info(from_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboxAnalyticsApi.get_inbox_top_accounts ...'
  end
  # verify the required parameter 'from_date' is set
  if @api_client.config.client_side_validation && from_date.nil?
    fail ArgumentError, "Missing the required parameter 'from_date' when calling InboxAnalyticsApi.get_inbox_top_accounts"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboxAnalyticsApi.get_inbox_top_accounts, must be smaller than or equal to 50.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboxAnalyticsApi.get_inbox_top_accounts, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/analytics/inbox/top-accounts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = from_date
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].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] || 'GetInboxTopAccounts200Response'

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

  new_options = opts.merge(
    :operation => :"InboxAnalyticsApi.get_inbox_top_accounts",
    :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: InboxAnalyticsApi#get_inbox_top_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_inbox_volume(from_date, opts = {}) ⇒ GetInboxVolume200Response

Get inbox messaging volume Daily inbox messaging volume + breakdowns. Folds the raw messaging events into three projections so the client can render the volume chart, KPI strip, and per-platform stacked bar from a single call. Max date range is 365 days.

Parameters:

  • from_date (Date)

    Inclusive lower bound (YYYY-MM-DD). Required.

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)

    Inclusive upper bound (YYYY-MM-DD). Defaults to today.

  • :profile_id (String)
  • :platform (String)

    Filter by single platform (facebook, instagram, twitter, etc.).

  • :account_id (String)
  • :source (String)

    Filter by metadata.source lineage (human, workflow, sequence, broadcast, comment_automation, api, contact, platform).

Returns:



430
431
432
433
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 430

def get_inbox_volume(from_date, opts = {})
  data, _status_code, _headers = get_inbox_volume_with_http_info(from_date, opts)
  data
end

#get_inbox_volume_with_http_info(from_date, opts = {}) ⇒ Array<(GetInboxVolume200Response, Integer, Hash)>

Get inbox messaging volume Daily inbox messaging volume + breakdowns. Folds the raw messaging events into three projections so the client can render the volume chart, KPI strip, and per-platform stacked bar from a single call. Max date range is 365 days.

Parameters:

  • from_date (Date)

    Inclusive lower bound (YYYY-MM-DD). Required.

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)

    Inclusive upper bound (YYYY-MM-DD). Defaults to today.

  • :profile_id (String)
  • :platform (String)

    Filter by single platform (facebook, instagram, twitter, etc.).

  • :account_id (String)
  • :source (String)

    Filter by metadata.source lineage (human, workflow, sequence, broadcast, comment_automation, api, contact, platform).

Returns:

  • (Array<(GetInboxVolume200Response, Integer, Hash)>)

    GetInboxVolume200Response data, response status code and response headers



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
489
490
491
492
493
494
495
496
497
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 445

def get_inbox_volume_with_http_info(from_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboxAnalyticsApi.get_inbox_volume ...'
  end
  # verify the required parameter 'from_date' is set
  if @api_client.config.client_side_validation && from_date.nil?
    fail ArgumentError, "Missing the required parameter 'from_date' when calling InboxAnalyticsApi.get_inbox_volume"
  end
  # resource path
  local_var_path = '/v1/analytics/inbox/volume'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = from_date
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].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] || 'GetInboxVolume200Response'

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

  new_options = opts.merge(
    :operation => :"InboxAnalyticsApi.get_inbox_volume",
    :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: InboxAnalyticsApi#get_inbox_volume\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_inbox_conversation_analytics(from_date, opts = {}) ⇒ ListInboxConversationAnalytics200Response

List conversation analytics Per-conversation listing with per-row totals + first/last message timestamps. The inbox analog of GET /v1/analytics (posts listing) — same filter shape, same pagination, same sort/order semantics. Use as the entry point for the per-conversation analytics drawer at /v1/analytics/inbox/conversations/conversationId. Rows are enriched with the conversation's participant info (participantName, participantUsername, participantPicture) and last-message preview by joining the Conversation document scoped to the caller's team. Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :account_id (String)
  • :source (String)
  • :limit (Integer) — default: default to 50
  • :page (Integer) — default: default to 1
  • :sort_by (String) — default: default to 'lastMessageAt'
  • :order (String) — default: default to 'desc'

Returns:



513
514
515
516
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 513

def list_inbox_conversation_analytics(from_date, opts = {})
  data, _status_code, _headers = list_inbox_conversation_analytics_with_http_info(from_date, opts)
  data
end

#list_inbox_conversation_analytics_with_http_info(from_date, opts = {}) ⇒ Array<(ListInboxConversationAnalytics200Response, Integer, Hash)>

List conversation analytics Per-conversation listing with per-row totals + first/last message timestamps. The inbox analog of GET /v1/analytics (posts listing) — same filter shape, same pagination, same sort/order semantics. Use as the entry point for the per-conversation analytics drawer at /v1/analytics/inbox/conversations/conversationId. Rows are enriched with the conversation's participant info (`participantName`, `participantUsername`, `participantPicture`) and last-message preview by joining the Conversation document scoped to the caller's team. Max date range is 365 days.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :to_date (Date)
  • :profile_id (String)
  • :platform (String)
  • :account_id (String)
  • :source (String)
  • :limit (Integer) — default: default to 50
  • :page (Integer) — default: default to 1
  • :sort_by (String) — default: default to 'lastMessageAt'
  • :order (String) — default: default to 'desc'

Returns:



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
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
# File 'lib/zernio-sdk/api/inbox_analytics_api.rb', line 532

def list_inbox_conversation_analytics_with_http_info(from_date, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: InboxAnalyticsApi.list_inbox_conversation_analytics ...'
  end
  # verify the required parameter 'from_date' is set
  if @api_client.config.client_side_validation && from_date.nil?
    fail ArgumentError, "Missing the required parameter 'from_date' when calling InboxAnalyticsApi.list_inbox_conversation_analytics"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboxAnalyticsApi.list_inbox_conversation_analytics, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling InboxAnalyticsApi.list_inbox_conversation_analytics, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page"]" when calling InboxAnalyticsApi.list_inbox_conversation_analytics, must be greater than or equal to 1.'
  end

  allowable_values = ["lastMessageAt", "firstMessageAt", "totalMessages", "received", "sent", "read", "failed"]
  if @api_client.config.client_side_validation && opts[:'sort_by'] && !allowable_values.include?(opts[:'sort_by'])
    fail ArgumentError, "invalid value for \"sort_by\", must be one of #{allowable_values}"
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
    fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v1/analytics/inbox/conversations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fromDate'] = from_date
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'platform'] = opts[:'platform'] if !opts[:'platform'].nil?
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?
  query_params[:'order'] = opts[:'order'] if !opts[:'order'].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] || 'ListInboxConversationAnalytics200Response'

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

  new_options = opts.merge(
    :operation => :"InboxAnalyticsApi.list_inbox_conversation_analytics",
    :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: InboxAnalyticsApi#list_inbox_conversation_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end