rcs 2.0.0.pre.rc.4 → 2.0.0.pre.rc.5
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/lib/rcs/campaigns/dlc/client.rb +12 -12
- data/lib/rcs/campaigns/rcs/types/upsert_rcs_agent.rb +4 -4
- data/lib/rcs/conversations/client.rb +2 -2
- data/lib/rcs/messages/mms/client.rb +2 -2
- data/lib/rcs/messages/sms/client.rb +2 -2
- data/lib/rcs/rcs/client.rb +316 -0
- data/lib/rcs/status/get/client.rb +4 -4
- data/lib/rcs/types/conversation_list.rb +28 -50
- data/lib/rcs/types/dlc_campaign_status.rb +2 -2
- data/lib/rcs/types/error_response.rb +59 -0
- data/lib/rcs/types/get_dlc_campaign_status_response_updates.rb +1 -1
- data/lib/rcs/types/message_schedule.rb +4 -5
- data/lib/rcs/types/rcs_campaign_schema_agent.rb +4 -4
- data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +4 -4
- data/lib/rcs/types/rcs_capabilities_result.rb +7 -0
- data/lib/rcs/types/rcs_capability.rb +82 -0
- data/lib/rcs/types/rcs_capability_actions.rb +105 -0
- data/lib/rcs/types/rcs_capability_cards.rb +67 -0
- data/lib/rcs/types/rcs_link_result.rb +75 -0
- data/lib/rcs/types/rcs_validate_content_media.rb +17 -3
- data/lib/rcs/types/rcs_whitelist_response.rb +58 -0
- data/lib/rcs/types/retrieved_conversations.rb +78 -0
- data/lib/rcs.rb +7 -0
- data/lib/requests.rb +2 -2
- data/lib/types_export.rb +8 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 262806a75a52a70e37dd92a0036ba70af3a59aa98ea132dd60f2dad6cbe2c95a
|
4
|
+
data.tar.gz: 5dcd700d3f9a65f9dfa3bd4551773fb8fa6789f39e998b053eef877fc95daf70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af03848b61375c06cd367fa1b2609616568daba7e7858e377e7f03cfb68f34f9d26b9681bbd9eb94164e48a35219db9932a260feebe59d4f0317243e4ee42e38
|
7
|
+
data.tar.gz: 82b3b96ff4b841b1cd3078487f938d01105639414d0bb0950728081aec53b0cd93ea570f8596445c7886d0fee6e38a492bfd6df60040bb82a1b87233ee588d96
|
@@ -58,9 +58,9 @@ module Pinnacle
|
|
58
58
|
Pinnacle::Types::AutofillDlcCampaignResponse.from_json(json_object: response.body)
|
59
59
|
end
|
60
60
|
|
61
|
-
# Retrieve
|
61
|
+
# Retrieve 10DLC campaign.
|
62
62
|
#
|
63
|
-
# @param campaign_id [Integer] Unique identifier of the
|
63
|
+
# @param campaign_id [Integer] Unique identifier of the 10DLC campaign.
|
64
64
|
# @param request_options [Pinnacle::RequestOptions]
|
65
65
|
# @return [Pinnacle::Types::DlcCampaignWithExtendedBrandAndStatus]
|
66
66
|
# @example
|
@@ -90,9 +90,9 @@ module Pinnacle
|
|
90
90
|
Pinnacle::Types::DlcCampaignWithExtendedBrandAndStatus.from_json(json_object: response.body)
|
91
91
|
end
|
92
92
|
|
93
|
-
# Submit your
|
93
|
+
# Submit your 10DLC campaign for approval and activation with carriers.
|
94
94
|
#
|
95
|
-
# @param campaign_id [Integer] Unique identifier of the
|
95
|
+
# @param campaign_id [Integer] Unique identifier of the 10DLC campaign to submit.
|
96
96
|
# @param request_options [Pinnacle::RequestOptions]
|
97
97
|
# @return [Pinnacle::Types::CampaignSubmissionResult]
|
98
98
|
# @example
|
@@ -122,7 +122,7 @@ module Pinnacle
|
|
122
122
|
Pinnacle::Types::CampaignSubmissionResult.from_json(json_object: response.body)
|
123
123
|
end
|
124
124
|
|
125
|
-
# Create a new
|
125
|
+
# Create a new 10DLC campaign or updates an existing one. <br>
|
126
126
|
# Omit campaignId to create a campaign.
|
127
127
|
#
|
128
128
|
# @param auto_renew [Boolean] Whether the campaign renews automatically.
|
@@ -207,7 +207,7 @@ module Pinnacle
|
|
207
207
|
Pinnacle::Types::DlcCampaignWithExtendedBrandAndStatus.from_json(json_object: response.body)
|
208
208
|
end
|
209
209
|
|
210
|
-
# Validate your
|
210
|
+
# Validate your 10DLC campaign configuration against carrier requirements and
|
211
211
|
# compliance rules.
|
212
212
|
#
|
213
213
|
# @param request [Hash] Request of type Pinnacle::Types::ValidateCampaignParams, as a Hash
|
@@ -286,9 +286,9 @@ module Pinnacle
|
|
286
286
|
end
|
287
287
|
end
|
288
288
|
|
289
|
-
# Retrieve
|
289
|
+
# Retrieve 10DLC campaign.
|
290
290
|
#
|
291
|
-
# @param campaign_id [Integer] Unique identifier of the
|
291
|
+
# @param campaign_id [Integer] Unique identifier of the 10DLC campaign.
|
292
292
|
# @param request_options [Pinnacle::RequestOptions]
|
293
293
|
# @return [Pinnacle::Types::DlcCampaignWithExtendedBrandAndStatus]
|
294
294
|
# @example
|
@@ -320,9 +320,9 @@ module Pinnacle
|
|
320
320
|
end
|
321
321
|
end
|
322
322
|
|
323
|
-
# Submit your
|
323
|
+
# Submit your 10DLC campaign for approval and activation with carriers.
|
324
324
|
#
|
325
|
-
# @param campaign_id [Integer] Unique identifier of the
|
325
|
+
# @param campaign_id [Integer] Unique identifier of the 10DLC campaign to submit.
|
326
326
|
# @param request_options [Pinnacle::RequestOptions]
|
327
327
|
# @return [Pinnacle::Types::CampaignSubmissionResult]
|
328
328
|
# @example
|
@@ -354,7 +354,7 @@ module Pinnacle
|
|
354
354
|
end
|
355
355
|
end
|
356
356
|
|
357
|
-
# Create a new
|
357
|
+
# Create a new 10DLC campaign or updates an existing one. <br>
|
358
358
|
# Omit campaignId to create a campaign.
|
359
359
|
#
|
360
360
|
# @param auto_renew [Boolean] Whether the campaign renews automatically.
|
@@ -441,7 +441,7 @@ module Pinnacle
|
|
441
441
|
end
|
442
442
|
end
|
443
443
|
|
444
|
-
# Validate your
|
444
|
+
# Validate your 10DLC campaign configuration against carrier requirements and
|
445
445
|
# compliance rules.
|
446
446
|
#
|
447
447
|
# @param request [Hash] Request of type Pinnacle::Types::ValidateCampaignParams, as a Hash
|
@@ -19,9 +19,9 @@ module Pinnacle
|
|
19
19
|
attr_reader :description
|
20
20
|
# @return [Array<Pinnacle::Campaigns::Rcs::Types::RcsAgentEmail>] List of emails (1-3 required).
|
21
21
|
attr_reader :emails
|
22
|
-
# @return [String] Link to the agent's hero.
|
22
|
+
# @return [String] Link to the agent's hero. Hero must be an image file with dimensions 1440x448px.
|
23
23
|
attr_reader :hero_url
|
24
|
-
# @return [String] Link to the agent's icon.
|
24
|
+
# @return [String] Link to the agent's icon. Icon must be an image file with dimensions 224x224px.
|
25
25
|
attr_reader :icon_url
|
26
26
|
# @return [String] Name of the agent.
|
27
27
|
attr_reader :name
|
@@ -41,8 +41,8 @@ module Pinnacle
|
|
41
41
|
# Must have sufficient contrast with white.
|
42
42
|
# @param description [String] Description of the agent.
|
43
43
|
# @param emails [Array<Pinnacle::Campaigns::Rcs::Types::RcsAgentEmail>] List of emails (1-3 required).
|
44
|
-
# @param hero_url [String] Link to the agent's hero.
|
45
|
-
# @param icon_url [String] Link to the agent's icon.
|
44
|
+
# @param hero_url [String] Link to the agent's hero. Hero must be an image file with dimensions 1440x448px.
|
45
|
+
# @param icon_url [String] Link to the agent's icon. Icon must be an image file with dimensions 224x224px.
|
46
46
|
# @param name [String] Name of the agent.
|
47
47
|
# @param phones [Array<Pinnacle::Campaigns::Rcs::Types::RcsAgentPhone>] List of phone numbers (1-3 required).
|
48
48
|
# @param websites [Array<Pinnacle::Campaigns::Rcs::Types::RcsAgentWebsite>] List of urls (1-3 required).
|
@@ -61,7 +61,7 @@ module Pinnacle
|
|
61
61
|
# @param receiver [String] Receiver's phone number in E.164 format.
|
62
62
|
# @param sender [String]
|
63
63
|
# @param request_options [Pinnacle::RequestOptions]
|
64
|
-
# @return [Pinnacle::Types::
|
64
|
+
# @return [Pinnacle::Types::ErrorResponse, Pinnacle::Types::RetrievedConversations]
|
65
65
|
# @example
|
66
66
|
# api = Pinnacle::Client.new(
|
67
67
|
# base_url: "https://api.example.com",
|
@@ -191,7 +191,7 @@ module Pinnacle
|
|
191
191
|
# @param receiver [String] Receiver's phone number in E.164 format.
|
192
192
|
# @param sender [String]
|
193
193
|
# @param request_options [Pinnacle::RequestOptions]
|
194
|
-
# @return [Pinnacle::Types::
|
194
|
+
# @return [Pinnacle::Types::ErrorResponse, Pinnacle::Types::RetrievedConversations]
|
195
195
|
# @example
|
196
196
|
# api = Pinnacle::Client.new(
|
197
197
|
# base_url: "https://api.example.com",
|
@@ -28,7 +28,7 @@ module Pinnacle
|
|
28
28
|
# @param options [Hash] Control how your MMS is processed and delivered.Request of type Pinnacle::Messages::Mms::Types::SendMmsOptions, as a Hash
|
29
29
|
# * :multiple_messages (Boolean)
|
30
30
|
# * :schedule (Hash)
|
31
|
-
# * :end_date (
|
31
|
+
# * :end_date (String)
|
32
32
|
# * :recurrence (String)
|
33
33
|
# * :send_at (String)
|
34
34
|
# * :timezone (String)
|
@@ -128,7 +128,7 @@ module Pinnacle
|
|
128
128
|
# @param options [Hash] Control how your MMS is processed and delivered.Request of type Pinnacle::Messages::Mms::Types::SendMmsOptions, as a Hash
|
129
129
|
# * :multiple_messages (Boolean)
|
130
130
|
# * :schedule (Hash)
|
131
|
-
# * :end_date (
|
131
|
+
# * :end_date (String)
|
132
132
|
# * :recurrence (String)
|
133
133
|
# * :send_at (String)
|
134
134
|
# * :timezone (String)
|
@@ -24,7 +24,7 @@ module Pinnacle
|
|
24
24
|
# @param from [String] Phone number that sends the message in E.164 format.
|
25
25
|
# @param options [Hash] Additional settings to customize SMS delivery.Request of type Pinnacle::Messages::Sms::Types::SendSmsOptions, as a Hash
|
26
26
|
# * :schedule (Hash)
|
27
|
-
# * :end_date (
|
27
|
+
# * :end_date (String)
|
28
28
|
# * :recurrence (String)
|
29
29
|
# * :send_at (String)
|
30
30
|
# * :timezone (String)
|
@@ -115,7 +115,7 @@ module Pinnacle
|
|
115
115
|
# @param from [String] Phone number that sends the message in E.164 format.
|
116
116
|
# @param options [Hash] Additional settings to customize SMS delivery.Request of type Pinnacle::Messages::Sms::Types::SendSmsOptions, as a Hash
|
117
117
|
# * :schedule (Hash)
|
118
|
-
# * :end_date (
|
118
|
+
# * :end_date (String)
|
119
119
|
# * :recurrence (String)
|
120
120
|
# * :send_at (String)
|
121
121
|
# * :timezone (String)
|
@@ -0,0 +1,316 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../../requests"
|
4
|
+
require_relative "../types/rcs_capabilities_result"
|
5
|
+
require "json"
|
6
|
+
require_relative "../types/rcs_whitelist_response"
|
7
|
+
require_relative "../types/rcs_link_result"
|
8
|
+
require "async"
|
9
|
+
|
10
|
+
module Pinnacle
|
11
|
+
class RcsClient
|
12
|
+
# @return [Pinnacle::RequestClient]
|
13
|
+
attr_reader :request_client
|
14
|
+
|
15
|
+
# @param request_client [Pinnacle::RequestClient]
|
16
|
+
# @return [Pinnacle::RcsClient]
|
17
|
+
def initialize(request_client:)
|
18
|
+
@request_client = request_client
|
19
|
+
end
|
20
|
+
|
21
|
+
# Check RCS capabilities for one or more phone numbers.
|
22
|
+
# This endpoint allows you to verify which RCS features (cards, buttons, etc.) are
|
23
|
+
# supported
|
24
|
+
# on specific phone numbers before sending RCS messages to them.
|
25
|
+
#
|
26
|
+
# @param phone_numbers [Array<String>] List of phone numbers to check RCS capabilities for (E.164 format)
|
27
|
+
# @param request_options [Pinnacle::RequestOptions]
|
28
|
+
# @return [Pinnacle::Types::RCS_CAPABILITIES_RESULT]
|
29
|
+
# @example
|
30
|
+
# api = Pinnacle::Client.new(
|
31
|
+
# base_url: "https://api.example.com",
|
32
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
33
|
+
# api_key: "YOUR_API_KEY"
|
34
|
+
# )
|
35
|
+
# api.rcs.get_capabilities(phone_numbers: ["+12345678901", "+19876543210"])
|
36
|
+
def get_capabilities(phone_numbers:, request_options: nil)
|
37
|
+
response = @request_client.conn.post do |req|
|
38
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
39
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
40
|
+
req.headers = {
|
41
|
+
**(req.headers || {}),
|
42
|
+
**@request_client.get_headers,
|
43
|
+
**(request_options&.additional_headers || {})
|
44
|
+
}.compact
|
45
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
46
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
47
|
+
end
|
48
|
+
req.body = { **(request_options&.additional_body_parameters || {}), phoneNumbers: phone_numbers }.compact
|
49
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/rcs/capabilities"
|
50
|
+
end
|
51
|
+
parsed_json = JSON.parse(response.body)
|
52
|
+
parsed_json&.transform_values do |value|
|
53
|
+
value = value.to_json
|
54
|
+
Pinnacle::Types::RcsCapability.from_json(json_object: value)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Whitelist a phone number for testing with your test RCS agent.
|
59
|
+
# ## Overview
|
60
|
+
# During development and testing, RCS agents can only send messages to whitelisted
|
61
|
+
# phone numbers.
|
62
|
+
# Use this endpoint to add test devices to your agent's whitelist before sending
|
63
|
+
# test messages.
|
64
|
+
# ## Verification Process
|
65
|
+
# After whitelisting a number, you'll need to complete verification:
|
66
|
+
# 1. Check the test device for an "RBM Tester Management" request
|
67
|
+
# 2. Accept the request on the device
|
68
|
+
# 3. Enter the 4-digit verification code in the Pinnacle dashboard at:
|
69
|
+
# ```
|
70
|
+
# .pinnacle.sh/dashboard/brands/{brandId}?campaignId={campaignId}&campaignType=RCS
|
71
|
+
# ```
|
72
|
+
# > **Important Notes**
|
73
|
+
# >
|
74
|
+
# > - **Testing only:** This is only required for test agents. Production agents
|
75
|
+
# can message any RCS-enabled number
|
76
|
+
# > - **AT&T limitation:** Whitelisting may currently fail for AT&T numbers
|
77
|
+
# > - **Verification required:** The whitelist request isn't complete until you
|
78
|
+
# verify the device.
|
79
|
+
#
|
80
|
+
# @param agent_id [String] The RCS agent ID (must be prefixed with 'agent_')
|
81
|
+
# @param phone_number [String] Phone number to whitelist for testing (E.164 format)
|
82
|
+
# @param request_options [Pinnacle::RequestOptions]
|
83
|
+
# @return [Pinnacle::Types::RcsWhitelistResponse]
|
84
|
+
# @example
|
85
|
+
# api = Pinnacle::Client.new(
|
86
|
+
# base_url: "https://api.example.com",
|
87
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
88
|
+
# api_key: "YOUR_API_KEY"
|
89
|
+
# )
|
90
|
+
# api.rcs.whitelist(agent_id: "agent_XXXXXXXXXXXX", phone_number: "+12345678901")
|
91
|
+
def whitelist(agent_id:, phone_number:, request_options: nil)
|
92
|
+
response = @request_client.conn.post do |req|
|
93
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
94
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
95
|
+
req.headers = {
|
96
|
+
**(req.headers || {}),
|
97
|
+
**@request_client.get_headers,
|
98
|
+
**(request_options&.additional_headers || {})
|
99
|
+
}.compact
|
100
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
101
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
102
|
+
end
|
103
|
+
req.body = {
|
104
|
+
**(request_options&.additional_body_parameters || {}),
|
105
|
+
agentId: agent_id,
|
106
|
+
phoneNumber: phone_number
|
107
|
+
}.compact
|
108
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/rcs/whitelist"
|
109
|
+
end
|
110
|
+
Pinnacle::Types::RcsWhitelistResponse.from_json(json_object: response.body)
|
111
|
+
end
|
112
|
+
|
113
|
+
# Generate a link for initiating an RCS conversation with your agent.
|
114
|
+
# Users can click these links to start conversations with your RCS agent directly
|
115
|
+
# from websites, emails, or other applications.
|
116
|
+
#
|
117
|
+
# @param agent_id [String] The RCS agent ID (must be prefixed with 'agent_')
|
118
|
+
# @param test_mode [Boolean] Link to the test agent or the production agent if false
|
119
|
+
# @param phone_number [String] Fallback phone number (E.164 format) to use if the phone number does not support
|
120
|
+
# RCS. If not provided, no url will be generated.
|
121
|
+
# @param body [String] Optional message body to pre-fill after the user clicks the link
|
122
|
+
# @param request_options [Pinnacle::RequestOptions]
|
123
|
+
# @return [Pinnacle::Types::RcsLinkResult]
|
124
|
+
# @example
|
125
|
+
# api = Pinnacle::Client.new(
|
126
|
+
# base_url: "https://api.example.com",
|
127
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
128
|
+
# api_key: "YOUR_API_KEY"
|
129
|
+
# )
|
130
|
+
# api.rcs.get_link(
|
131
|
+
# agent_id: "agent_XXXXXXXXXXXX",
|
132
|
+
# test_mode: false,
|
133
|
+
# phone_number: "+12345678901",
|
134
|
+
# body: "Hello, I need help with my order"
|
135
|
+
# )
|
136
|
+
def get_link(agent_id:, test_mode: nil, phone_number: nil, body: nil, request_options: nil)
|
137
|
+
response = @request_client.conn.post do |req|
|
138
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
139
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
140
|
+
req.headers = {
|
141
|
+
**(req.headers || {}),
|
142
|
+
**@request_client.get_headers,
|
143
|
+
**(request_options&.additional_headers || {})
|
144
|
+
}.compact
|
145
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
146
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
147
|
+
end
|
148
|
+
req.body = {
|
149
|
+
**(request_options&.additional_body_parameters || {}),
|
150
|
+
agentId: agent_id,
|
151
|
+
testMode: test_mode,
|
152
|
+
phoneNumber: phone_number,
|
153
|
+
body: body
|
154
|
+
}.compact
|
155
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/rcs/link"
|
156
|
+
end
|
157
|
+
Pinnacle::Types::RcsLinkResult.from_json(json_object: response.body)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
class AsyncRcsClient
|
162
|
+
# @return [Pinnacle::AsyncRequestClient]
|
163
|
+
attr_reader :request_client
|
164
|
+
|
165
|
+
# @param request_client [Pinnacle::AsyncRequestClient]
|
166
|
+
# @return [Pinnacle::AsyncRcsClient]
|
167
|
+
def initialize(request_client:)
|
168
|
+
@request_client = request_client
|
169
|
+
end
|
170
|
+
|
171
|
+
# Check RCS capabilities for one or more phone numbers.
|
172
|
+
# This endpoint allows you to verify which RCS features (cards, buttons, etc.) are
|
173
|
+
# supported
|
174
|
+
# on specific phone numbers before sending RCS messages to them.
|
175
|
+
#
|
176
|
+
# @param phone_numbers [Array<String>] List of phone numbers to check RCS capabilities for (E.164 format)
|
177
|
+
# @param request_options [Pinnacle::RequestOptions]
|
178
|
+
# @return [Pinnacle::Types::RCS_CAPABILITIES_RESULT]
|
179
|
+
# @example
|
180
|
+
# api = Pinnacle::Client.new(
|
181
|
+
# base_url: "https://api.example.com",
|
182
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
183
|
+
# api_key: "YOUR_API_KEY"
|
184
|
+
# )
|
185
|
+
# api.rcs.get_capabilities(phone_numbers: ["+12345678901", "+19876543210"])
|
186
|
+
def get_capabilities(phone_numbers:, request_options: nil)
|
187
|
+
Async do
|
188
|
+
response = @request_client.conn.post do |req|
|
189
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
190
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
191
|
+
req.headers = {
|
192
|
+
**(req.headers || {}),
|
193
|
+
**@request_client.get_headers,
|
194
|
+
**(request_options&.additional_headers || {})
|
195
|
+
}.compact
|
196
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
197
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
198
|
+
end
|
199
|
+
req.body = { **(request_options&.additional_body_parameters || {}), phoneNumbers: phone_numbers }.compact
|
200
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/rcs/capabilities"
|
201
|
+
end
|
202
|
+
parsed_json = JSON.parse(response.body)
|
203
|
+
parsed_json&.transform_values do |value|
|
204
|
+
value = value.to_json
|
205
|
+
Pinnacle::Types::RcsCapability.from_json(json_object: value)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
# Whitelist a phone number for testing with your test RCS agent.
|
211
|
+
# ## Overview
|
212
|
+
# During development and testing, RCS agents can only send messages to whitelisted
|
213
|
+
# phone numbers.
|
214
|
+
# Use this endpoint to add test devices to your agent's whitelist before sending
|
215
|
+
# test messages.
|
216
|
+
# ## Verification Process
|
217
|
+
# After whitelisting a number, you'll need to complete verification:
|
218
|
+
# 1. Check the test device for an "RBM Tester Management" request
|
219
|
+
# 2. Accept the request on the device
|
220
|
+
# 3. Enter the 4-digit verification code in the Pinnacle dashboard at:
|
221
|
+
# ```
|
222
|
+
# .pinnacle.sh/dashboard/brands/{brandId}?campaignId={campaignId}&campaignType=RCS
|
223
|
+
# ```
|
224
|
+
# > **Important Notes**
|
225
|
+
# >
|
226
|
+
# > - **Testing only:** This is only required for test agents. Production agents
|
227
|
+
# can message any RCS-enabled number
|
228
|
+
# > - **AT&T limitation:** Whitelisting may currently fail for AT&T numbers
|
229
|
+
# > - **Verification required:** The whitelist request isn't complete until you
|
230
|
+
# verify the device.
|
231
|
+
#
|
232
|
+
# @param agent_id [String] The RCS agent ID (must be prefixed with 'agent_')
|
233
|
+
# @param phone_number [String] Phone number to whitelist for testing (E.164 format)
|
234
|
+
# @param request_options [Pinnacle::RequestOptions]
|
235
|
+
# @return [Pinnacle::Types::RcsWhitelistResponse]
|
236
|
+
# @example
|
237
|
+
# api = Pinnacle::Client.new(
|
238
|
+
# base_url: "https://api.example.com",
|
239
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
240
|
+
# api_key: "YOUR_API_KEY"
|
241
|
+
# )
|
242
|
+
# api.rcs.whitelist(agent_id: "agent_XXXXXXXXXXXX", phone_number: "+12345678901")
|
243
|
+
def whitelist(agent_id:, phone_number:, request_options: nil)
|
244
|
+
Async do
|
245
|
+
response = @request_client.conn.post do |req|
|
246
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
247
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
248
|
+
req.headers = {
|
249
|
+
**(req.headers || {}),
|
250
|
+
**@request_client.get_headers,
|
251
|
+
**(request_options&.additional_headers || {})
|
252
|
+
}.compact
|
253
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
254
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
255
|
+
end
|
256
|
+
req.body = {
|
257
|
+
**(request_options&.additional_body_parameters || {}),
|
258
|
+
agentId: agent_id,
|
259
|
+
phoneNumber: phone_number
|
260
|
+
}.compact
|
261
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/rcs/whitelist"
|
262
|
+
end
|
263
|
+
Pinnacle::Types::RcsWhitelistResponse.from_json(json_object: response.body)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
267
|
+
# Generate a link for initiating an RCS conversation with your agent.
|
268
|
+
# Users can click these links to start conversations with your RCS agent directly
|
269
|
+
# from websites, emails, or other applications.
|
270
|
+
#
|
271
|
+
# @param agent_id [String] The RCS agent ID (must be prefixed with 'agent_')
|
272
|
+
# @param test_mode [Boolean] Link to the test agent or the production agent if false
|
273
|
+
# @param phone_number [String] Fallback phone number (E.164 format) to use if the phone number does not support
|
274
|
+
# RCS. If not provided, no url will be generated.
|
275
|
+
# @param body [String] Optional message body to pre-fill after the user clicks the link
|
276
|
+
# @param request_options [Pinnacle::RequestOptions]
|
277
|
+
# @return [Pinnacle::Types::RcsLinkResult]
|
278
|
+
# @example
|
279
|
+
# api = Pinnacle::Client.new(
|
280
|
+
# base_url: "https://api.example.com",
|
281
|
+
# environment: Pinnacle::Environment::DEFAULT,
|
282
|
+
# api_key: "YOUR_API_KEY"
|
283
|
+
# )
|
284
|
+
# api.rcs.get_link(
|
285
|
+
# agent_id: "agent_XXXXXXXXXXXX",
|
286
|
+
# test_mode: false,
|
287
|
+
# phone_number: "+12345678901",
|
288
|
+
# body: "Hello, I need help with my order"
|
289
|
+
# )
|
290
|
+
def get_link(agent_id:, test_mode: nil, phone_number: nil, body: nil, request_options: nil)
|
291
|
+
Async do
|
292
|
+
response = @request_client.conn.post do |req|
|
293
|
+
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
294
|
+
req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
295
|
+
req.headers = {
|
296
|
+
**(req.headers || {}),
|
297
|
+
**@request_client.get_headers,
|
298
|
+
**(request_options&.additional_headers || {})
|
299
|
+
}.compact
|
300
|
+
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
301
|
+
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
302
|
+
end
|
303
|
+
req.body = {
|
304
|
+
**(request_options&.additional_body_parameters || {}),
|
305
|
+
agentId: agent_id,
|
306
|
+
testMode: test_mode,
|
307
|
+
phoneNumber: phone_number,
|
308
|
+
body: body
|
309
|
+
}.compact
|
310
|
+
req.url "#{@request_client.get_url(request_options: request_options)}/rcs/link"
|
311
|
+
end
|
312
|
+
Pinnacle::Types::RcsLinkResult.from_json(json_object: response.body)
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
@@ -84,9 +84,9 @@ module Pinnacle
|
|
84
84
|
Pinnacle::Types::TollFreeCampaignStatus.from_json(json_object: response.body)
|
85
85
|
end
|
86
86
|
|
87
|
-
# Retrieve a
|
87
|
+
# Retrieve a 10DLC campaign's status.
|
88
88
|
#
|
89
|
-
# @param campaign_id [Integer] ID of the
|
89
|
+
# @param campaign_id [Integer] ID of the 10DLC campaign.
|
90
90
|
# @param request_options [Pinnacle::RequestOptions]
|
91
91
|
# @return [Pinnacle::Types::DlcCampaignStatus]
|
92
92
|
# @example
|
@@ -260,9 +260,9 @@ module Pinnacle
|
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
263
|
-
# Retrieve a
|
263
|
+
# Retrieve a 10DLC campaign's status.
|
264
264
|
#
|
265
|
-
# @param campaign_id [Integer] ID of the
|
265
|
+
# @param campaign_id [Integer] ID of the 10DLC campaign.
|
266
266
|
# @param request_options [Pinnacle::RequestOptions]
|
267
267
|
# @return [Pinnacle::Types::DlcCampaignStatus]
|
268
268
|
# @example
|
@@ -1,66 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "conversation"
|
4
|
-
require "ostruct"
|
5
3
|
require "json"
|
4
|
+
require_relative "error_response"
|
5
|
+
require_relative "retrieved_conversations"
|
6
6
|
|
7
7
|
module Pinnacle
|
8
8
|
module Types
|
9
9
|
# Response for list conversation.
|
10
10
|
class ConversationList
|
11
|
-
# @return [Integer] Total number of conversations matching the filter.
|
12
|
-
attr_reader :count
|
13
|
-
# @return [Array<Pinnacle::Types::Conversation>]
|
14
|
-
attr_reader :conversations
|
15
|
-
# @return [Boolean] Indicates if more conversations are available beyond the current page.
|
16
|
-
attr_reader :has_more
|
17
|
-
# @return [OpenStruct] Additional properties unmapped to the current class definition
|
18
|
-
attr_reader :additional_properties
|
19
|
-
# @return [Object]
|
20
|
-
attr_reader :_field_set
|
21
|
-
protected :_field_set
|
22
|
-
|
23
|
-
OMIT = Object.new
|
24
|
-
|
25
|
-
# @param count [Integer] Total number of conversations matching the filter.
|
26
|
-
# @param conversations [Array<Pinnacle::Types::Conversation>]
|
27
|
-
# @param has_more [Boolean] Indicates if more conversations are available beyond the current page.
|
28
|
-
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|
29
|
-
# @return [Pinnacle::Types::ConversationList]
|
30
|
-
def initialize(count:, conversations:, has_more:, additional_properties: nil)
|
31
|
-
@count = count
|
32
|
-
@conversations = conversations
|
33
|
-
@has_more = has_more
|
34
|
-
@additional_properties = additional_properties
|
35
|
-
@_field_set = { "count": count, "conversations": conversations, "hasMore": has_more }
|
36
|
-
end
|
37
|
-
|
38
11
|
# Deserialize a JSON object to an instance of ConversationList
|
39
12
|
#
|
40
13
|
# @param json_object [String]
|
41
14
|
# @return [Pinnacle::Types::ConversationList]
|
42
15
|
def self.from_json(json_object:)
|
43
16
|
struct = JSON.parse(json_object, object_class: OpenStruct)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
17
|
+
begin
|
18
|
+
Pinnacle::Types::ErrorResponse.validate_raw(obj: struct)
|
19
|
+
return Pinnacle::Types::ErrorResponse.from_json(json_object: struct) unless struct.nil?
|
20
|
+
|
21
|
+
return nil
|
22
|
+
rescue StandardError
|
23
|
+
# noop
|
49
24
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
conversations: conversations,
|
54
|
-
has_more: has_more,
|
55
|
-
additional_properties: struct
|
56
|
-
)
|
57
|
-
end
|
25
|
+
begin
|
26
|
+
Pinnacle::Types::RetrievedConversations.validate_raw(obj: struct)
|
27
|
+
return Pinnacle::Types::RetrievedConversations.from_json(json_object: struct) unless struct.nil?
|
58
28
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
29
|
+
return nil
|
30
|
+
rescue StandardError
|
31
|
+
# noop
|
32
|
+
end
|
33
|
+
struct
|
64
34
|
end
|
65
35
|
|
66
36
|
# Leveraged for Union-type generation, validate_raw attempts to parse the given
|
@@ -70,9 +40,17 @@ module Pinnacle
|
|
70
40
|
# @param obj [Object]
|
71
41
|
# @return [Void]
|
72
42
|
def self.validate_raw(obj:)
|
73
|
-
|
74
|
-
|
75
|
-
|
43
|
+
begin
|
44
|
+
return Pinnacle::Types::ErrorResponse.validate_raw(obj: obj)
|
45
|
+
rescue StandardError
|
46
|
+
# noop
|
47
|
+
end
|
48
|
+
begin
|
49
|
+
return Pinnacle::Types::RetrievedConversations.validate_raw(obj: obj)
|
50
|
+
rescue StandardError
|
51
|
+
# noop
|
52
|
+
end
|
53
|
+
raise("Passed value matched no type within the union, validation failed.")
|
76
54
|
end
|
77
55
|
end
|
78
56
|
end
|
@@ -22,7 +22,7 @@ module Pinnacle
|
|
22
22
|
# `FAILED`: Issues and errors related to the campaign's details. See
|
23
23
|
# [error](dlc-campaign#response.body.error) for these potential issues.
|
24
24
|
attr_reader :status
|
25
|
-
# @return [Pinnacle::Types::GetDlcCampaignStatusResponseUpdates] Status of
|
25
|
+
# @return [Pinnacle::Types::GetDlcCampaignStatusResponseUpdates] Status of local long code numbers that are being attached to this campaign. <br>
|
26
26
|
# Note that phone numbers can only be attached to `VERIFIED` campaigns via the
|
27
27
|
# [attach campaign endpoint](../phone-numbers/attach-campaign).
|
28
28
|
attr_reader :updates
|
@@ -44,7 +44,7 @@ module Pinnacle
|
|
44
44
|
# `VERIFIED`: Approved and ready to send messages.<br>
|
45
45
|
# `FAILED`: Issues and errors related to the campaign's details. See
|
46
46
|
# [error](dlc-campaign#response.body.error) for these potential issues.
|
47
|
-
# @param updates [Pinnacle::Types::GetDlcCampaignStatusResponseUpdates] Status of
|
47
|
+
# @param updates [Pinnacle::Types::GetDlcCampaignStatusResponseUpdates] Status of local long code numbers that are being attached to this campaign. <br>
|
48
48
|
# Note that phone numbers can only be attached to `VERIFIED` campaigns via the
|
49
49
|
# [attach campaign endpoint](../phone-numbers/attach-campaign).
|
50
50
|
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
|