Class: Telnyx::Resources::EmailThreads

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/email_threads.rb,
sig/telnyx/resources/email_threads.rbs

Overview

Account-wide conversation threads across every inbox, for agents operating many inboxes at once.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ EmailThreads

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of EmailThreads.

Parameters:



86
87
88
# File 'lib/telnyx/resources/email_threads.rb', line 86

def initialize(client:)
  @client = client
end

Instance Method Details

#list(filter_inbox_id: nil, filter_label: nil, page_after: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Models::EmailInboxes::InboundThreadListResponse

Some parameter documentations has been truncated, see Models::EmailThreadListParams for more details.

Lists thread summaries for the whole account, newest first, using stable cursor pagination. An agent operating many inboxes gets every conversation in one call instead of one call per inbox. Each thread carries its own inbox_id so a reply can be routed back to the right inbox. Use filter[inbox_id] (repeatable) to narrow the result to specific inboxes. Because a thread ID can be delivered to multiple inboxes, each result is identified by its (inbox_id, id) pair.

Parameters:

  • filter_inbox_id (Array<String>)

    Restrict results to one or more inboxes. Repeat the parameter

  • filter_label (String)

    Returns only threads carrying this label. Matching is exact and case-sensitive.

  • page_after (String)

    Opaque cursor returned by the previous page.

  • page_size (Integer)

    Number of results to return. Defaults to 25; maximum is 100.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/telnyx/resources/email_threads.rb', line 66

def list(params = {})
  parsed, options = Telnyx::EmailThreadListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "email_threads",
    query: query.transform_keys(
      filter_inbox_id: "filter[inbox_id]",
      filter_label: "filter[label]",
      page_after: "page[after]",
      page_size: "page[size]"
    ),
    model: Telnyx::EmailInboxes::InboundThreadListResponse,
    options: options
  )
end

#retrieve(thread_id, inbox_id:, page_after: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Models::EmailThreadRetrieveResponse

Returns a thread and a bounded page of its inbound and outbound messages, interleaved in chronological order. The inbox_id returned by the list endpoint is required because a thread ID can occur in multiple inboxes. Only messages matching that (inbox_id, thread_id) pair are returned. Threads outside the account return an opaque 404.

Parameters:

  • thread_id (String)

    Email thread UUID.

  • inbox_id (String)

    Inbox UUID that, together with thread_id, identifies the thread.

  • page_after (String)

    Opaque message cursor returned by the previous thread-detail page.

  • page_size (Integer)

    Number of thread messages to return. Defaults to 25; maximum is 100.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/telnyx/resources/email_threads.rb', line 29

def retrieve(thread_id, params)
  parsed, options = Telnyx::EmailThreadRetrieveParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["email_threads/%1$s", thread_id],
    query: query.transform_keys(page_after: "page[after]", page_size: "page[size]"),
    model: Telnyx::Models::EmailThreadRetrieveResponse,
    options: options
  )
end