Class: Telnyx::Resources::Rcs::Agents

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

Overview

Manage RCS agent registration, testing, verification, and launch.

Defined Under Namespace

Classes: TestDevices

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Agents

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 Agents.



206
207
208
209
# File 'lib/telnyx/resources/rcs/agents.rb', line 206

def initialize(client:)
  @client = client
  @test_devices = Telnyx::Resources::Rcs::Agents::TestDevices.new(client: client)
end

Instance Attribute Details

#test_devicesTelnyx::Resources::Rcs::Agents::TestDevices (readonly)

Manage RCS agent registration, testing, verification, and launch.



10
11
12
# File 'lib/telnyx/resources/rcs/agents.rb', line 10

def test_devices
  @test_devices
end

Instance Method Details

#create(brand_id:, configuration:, display_name:, use_case:, idempotency_key:, hosting_region: nil, profile_id: nil, request_options: {}) ⇒ Telnyx::Models::Rcs::AgentResponse

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

Creates an editable RCS agent draft under a brand. The Idempotency-Key is scoped to the authenticated organization. Reusing the key with the same request returns the original agent, while reusing it with a different request returns a conflict.



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/telnyx/resources/rcs/agents.rb', line 41

def create(params)
  parsed, options = Telnyx::Rcs::AgentCreateParams.dump_request(params)
  header_params = {idempotency_key: "idempotency-key"}
  @client.request(
    method: :post,
    path: "rcs/agents",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Telnyx::Rcs::AgentResponse,
    options: options
  )
end

#launch(id, campaign:, testing:, request_options: {}) ⇒ Telnyx::Models::Rcs::AgentResponse

Adds the campaign and testing configuration, then starts asynchronous carrier launch. Agent basics must already be submitted. Repeating a launch that is already in progress returns the current agent without creating new work.



149
150
151
152
153
154
155
156
157
158
# File 'lib/telnyx/resources/rcs/agents.rb', line 149

def launch(id, params)
  parsed, options = Telnyx::Rcs::AgentLaunchParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["rcs/agents/%1$s/launch", id],
    body: parsed,
    model: Telnyx::Rcs::AgentResponse,
    options: options
  )
end

#list(brand_id: nil, request_options: {}) ⇒ Array<Telnyx::Models::Rcs::AgentResponse>

Lists RCS agents owned by the authenticated organization, optionally filtered by brand.



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/telnyx/resources/rcs/agents.rb', line 120

def list(params = {})
  parsed, options = Telnyx::Rcs::AgentListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "rcs/agents",
    query: query,
    model: Telnyx::Internal::Type::ArrayOf[Telnyx::Rcs::AgentResponse],
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::Rcs::AgentResponse

Retrieves an RCS agent, section statuses, test devices, carrier approvals, and provider capabilities.



66
67
68
69
70
71
72
73
# File 'lib/telnyx/resources/rcs/agents.rb', line 66

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["rcs/agents/%1$s", id],
    model: Telnyx::Rcs::AgentResponse,
    options: params[:request_options]
  )
end

#retrieve_carrier_approvals(id, request_options: {}) ⇒ Array<Telnyx::Models::Rcs::CarrierApprovalResponse>

Lists carrier approval records for an RCS agent. The provider may expose per-carrier, hub-level, or bot-level approval status.



172
173
174
175
176
177
178
179
# File 'lib/telnyx/resources/rcs/agents.rb', line 172

def retrieve_carrier_approvals(id, params = {})
  @client.request(
    method: :get,
    path: ["rcs/agents/%1$s/carrier_approvals", id],
    model: Telnyx::Internal::Type::ArrayOf[Telnyx::Rcs::CarrierApprovalResponse],
    options: params[:request_options]
  )
end

#submit(id, request_options: {}) ⇒ Telnyx::Models::Rcs::AgentResponse

Starts asynchronous provider provisioning and submits the agent's basic configuration. The brand must be VERIFIED. Repeating this request for an in-progress agent returns its current state without creating new work.



194
195
196
197
198
199
200
201
# File 'lib/telnyx/resources/rcs/agents.rb', line 194

def submit(id, params = {})
  @client.request(
    method: :post,
    path: ["rcs/agents/%1$s/submit", id],
    model: Telnyx::Rcs::AgentResponse,
    options: params[:request_options]
  )
end

#update(id, configuration: nil, display_name: nil, hosting_region: nil, profile_id: nil, use_case: nil, request_options: {}) ⇒ Telnyx::Models::Rcs::AgentResponse

Updates one or more fields on an agent while its status is CREATED. Submitted agents cannot be changed through this endpoint.



97
98
99
100
101
102
103
104
105
106
# File 'lib/telnyx/resources/rcs/agents.rb', line 97

def update(id, params = {})
  parsed, options = Telnyx::Rcs::AgentUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["rcs/agents/%1$s", id],
    body: parsed,
    model: Telnyx::Rcs::AgentResponse,
    options: options
  )
end