rcs 2.0.0.pre.rc.5 → 2.0.1

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.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rcs/brands/client.rb +36 -24
  3. data/lib/rcs/campaigns/dlc/client.rb +36 -26
  4. data/lib/rcs/campaigns/rcs/client.rb +26 -22
  5. data/lib/rcs/campaigns/rcs/types/rcs_autofill_response.rb +6 -6
  6. data/lib/rcs/campaigns/toll_free/client.rb +32 -26
  7. data/lib/rcs/campaigns/toll_free/types/toll_free_autofill_response.rb +6 -6
  8. data/lib/rcs/contacts/client.rb +10 -8
  9. data/lib/rcs/conversations/client.rb +144 -16
  10. data/lib/rcs/conversations/types/conversations_list_messages_request_direction.rb +12 -0
  11. data/lib/rcs/conversations/types/conversations_list_messages_request_sort_order.rb +12 -0
  12. data/lib/rcs/conversations/types/conversations_list_messages_request_status.rb +17 -0
  13. data/lib/rcs/conversations/types/conversations_list_messages_request_type.rb +13 -0
  14. data/lib/rcs/messages/client.rb +12 -29
  15. data/lib/rcs/messages/rcs/client.rb +125 -1
  16. data/lib/rcs/messages/rcs/types/send_typing_indicator_schema_options.rb +66 -0
  17. data/lib/rcs/phone_numbers/campaign/client.rb +20 -6
  18. data/lib/rcs/phone_numbers/client.rb +0 -14
  19. data/lib/rcs/phone_numbers/webhook/client.rb +12 -10
  20. data/lib/rcs/rcs/client.rb +32 -18
  21. data/lib/rcs/status/get/client.rb +32 -16
  22. data/lib/rcs/tools/contact_card/client.rb +18 -8
  23. data/lib/rcs/tools/file/client.rb +92 -2
  24. data/lib/rcs/tools/file/types/upload_file_options.rb +21 -3
  25. data/lib/rcs/tools/url/client.rb +4 -2
  26. data/lib/rcs/types/attach_webhook_by_id_params.rb +5 -5
  27. data/lib/rcs/types/attach_webhook_response_webhook.rb +5 -3
  28. data/lib/rcs/types/autofill_campaign_params.rb +15 -3
  29. data/lib/rcs/types/autofill_dlc_campaign_response.rb +10 -6
  30. data/lib/rcs/types/autofill_dlc_response_keywords.rb +8 -10
  31. data/lib/rcs/types/autofill_dlc_response_keywords_help.rb +3 -3
  32. data/lib/rcs/types/autofill_dlc_response_keywords_opt_in.rb +6 -4
  33. data/lib/rcs/types/autofill_dlc_response_keywords_opt_out.rb +3 -3
  34. data/lib/rcs/types/autofill_dlc_response_options.rb +12 -12
  35. data/lib/rcs/types/brand_status.rb +5 -3
  36. data/lib/rcs/types/{inbound_button.rb → button_clicked.rb} +7 -7
  37. data/lib/rcs/types/button_clicked_data.rb +80 -0
  38. data/lib/rcs/types/button_clicked_data_button.rb +118 -0
  39. data/lib/rcs/types/{click_action_data.rb → button_clicked_data_button_raw.rb} +10 -8
  40. data/lib/rcs/types/button_clicked_data_button_type.rb +15 -0
  41. data/lib/rcs/types/campaign_query.rb +10 -2
  42. data/lib/rcs/types/contact.rb +5 -3
  43. data/lib/rcs/types/contact_id.rb +5 -3
  44. data/lib/rcs/types/conversation.rb +16 -8
  45. data/lib/rcs/types/conversation_by_id_params.rb +7 -3
  46. data/lib/rcs/types/conversation_contact.rb +5 -3
  47. data/lib/rcs/types/conversation_list.rb +50 -28
  48. data/lib/rcs/types/create_url_options.rb +4 -2
  49. data/lib/rcs/types/detached_webhook_info.rb +5 -3
  50. data/lib/rcs/types/dlc_campaign_status.rb +5 -3
  51. data/lib/rcs/types/dlc_campaign_with_extended_brand_and_status.rb +21 -19
  52. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_help.rb +3 -3
  53. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_in.rb +6 -4
  54. data/lib/rcs/types/dlc_with_extended_brand_and_status_keywords_opt_out.rb +6 -4
  55. data/lib/rcs/types/extended_brand.rb +25 -13
  56. data/lib/rcs/types/extended_brand_with_vetting.rb +25 -13
  57. data/lib/rcs/types/extended_rcs_campaign.rb +25 -14
  58. data/lib/rcs/types/link_click_event.rb +1 -17
  59. data/lib/rcs/types/message.rb +5 -3
  60. data/lib/rcs/types/message_content.rb +4 -4
  61. data/lib/rcs/types/message_event.rb +143 -0
  62. data/lib/rcs/types/message_event_content.rb +127 -0
  63. data/lib/rcs/types/message_event_conversation.rb +82 -0
  64. data/lib/rcs/types/message_event_direction.rb +11 -0
  65. data/lib/rcs/types/message_event_mms_content.rb +94 -0
  66. data/lib/rcs/types/message_event_rcs_button_data.rb +104 -0
  67. data/lib/rcs/types/message_event_rcs_cards_content.rb +99 -0
  68. data/lib/rcs/types/message_event_rcs_cards_content_cards_item.rb +94 -0
  69. data/lib/rcs/types/message_event_rcs_location_data.rb +91 -0
  70. data/lib/rcs/types/message_event_rcs_media_content.rb +94 -0
  71. data/lib/rcs/types/message_event_rcs_text_content.rb +92 -0
  72. data/lib/rcs/types/message_event_sms_content.rb +81 -0
  73. data/lib/rcs/types/{retrieved_conversations.rb → message_list.rb} +26 -25
  74. data/lib/rcs/types/message_with_reaction.rb +197 -0
  75. data/lib/rcs/types/message_with_reaction_direction.rb +11 -0
  76. data/lib/rcs/types/{error_response.rb → not_found_error_body.rb} +7 -7
  77. data/lib/rcs/types/options.rb +111 -0
  78. data/lib/rcs/types/phone_number_campaign_attach_phone_numbers_item_campaign.rb +7 -3
  79. data/lib/rcs/types/phone_number_campaign_detach_phone_numbers_item_campaign.rb +7 -3
  80. data/lib/rcs/types/pinnacle_file_upload_metadata.rb +18 -2
  81. data/lib/rcs/types/profile_status_enum.rb +4 -4
  82. data/lib/rcs/types/rcs_base_options.rb +12 -1
  83. data/lib/rcs/types/rcs_button_call.rb +11 -2
  84. data/lib/rcs/types/rcs_button_open_url.rb +38 -2
  85. data/lib/rcs/types/rcs_button_open_url_webview_mode.rb +19 -0
  86. data/lib/rcs/types/rcs_button_request_user_location.rb +15 -3
  87. data/lib/rcs/types/rcs_button_schedule_event.rb +9 -1
  88. data/lib/rcs/types/rcs_button_send_location.rb +22 -2
  89. data/lib/rcs/types/rcs_button_trigger.rb +8 -6
  90. data/lib/rcs/types/rcs_campaign.rb +3 -3
  91. data/lib/rcs/types/rcs_campaign_schema_extra_agent.rb +8 -8
  92. data/lib/rcs/types/rcs_campaign_status.rb +5 -3
  93. data/lib/rcs/types/reaction_result.rb +10 -6
  94. data/lib/rcs/types/refreshed_file.rb +67 -0
  95. data/lib/rcs/types/rich_cards_message.rb +10 -10
  96. data/lib/rcs/types/{rcs.rb → rich_message.rb} +3 -3
  97. data/lib/rcs/types/scheduled_messaage.rb +5 -3
  98. data/lib/rcs/types/send_rcs_card_options.rb +132 -0
  99. data/lib/rcs/types/send_rcs_card_options_standalone_card.rb +78 -0
  100. data/lib/rcs/types/send_rcs_card_options_standalone_card_image_alignment.rb +12 -0
  101. data/lib/rcs/types/send_rcs_card_options_standalone_card_orientation.rb +11 -0
  102. data/lib/rcs/types/send_typing_indicator_response.rb +100 -0
  103. data/lib/rcs/types/sent_mms_details.rb +4 -2
  104. data/lib/rcs/types/sent_rcs_details.rb +12 -13
  105. data/lib/rcs/types/sent_sms_details.rb +5 -3
  106. data/lib/rcs/types/toll_free_campaign.rb +3 -3
  107. data/lib/rcs/types/toll_free_campaign_status.rb +5 -3
  108. data/lib/rcs/types/toll_free_campaign_with_extended_brand_and_status.rb +3 -5
  109. data/lib/rcs/types/updated_contact_id.rb +5 -3
  110. data/lib/rcs/types/user_event.rb +83 -0
  111. data/lib/rcs/types/user_event_conversation.rb +78 -0
  112. data/lib/rcs/types/v_card_data.rb +5 -3
  113. data/lib/rcs/types/validate_campaign_params.rb +15 -3
  114. data/lib/rcs/types/vcard.rb +5 -3
  115. data/lib/rcs/types/vcard_content.rb +5 -3
  116. data/lib/rcs/types/vcard_resource.rb +5 -3
  117. data/lib/rcs/types/webhook_event_enum.rb +1 -0
  118. data/lib/rcs/types/webhooks.rb +5 -3
  119. data/lib/requests.rb +2 -2
  120. data/lib/types_export.rb +37 -7
  121. metadata +41 -11
  122. data/lib/rcs/types/click_action.rb +0 -73
  123. data/lib/rcs/types/click_action_data_metadata.rb +0 -69
@@ -4,34 +4,23 @@ require_relative "../../requests"
4
4
  require_relative "../types/message"
5
5
  require_relative "types/react_message_options"
6
6
  require_relative "../types/reaction_result"
7
- require_relative "sms/client"
8
- require_relative "mms/client"
9
- require_relative "rcs/client"
10
7
  require "async"
11
8
 
12
9
  module Pinnacle
13
10
  class MessagesClient
14
11
  # @return [Pinnacle::RequestClient]
15
12
  attr_reader :request_client
16
- # @return [Pinnacle::Messages::SmsClient]
17
- attr_reader :sms
18
- # @return [Pinnacle::Messages::MmsClient]
19
- attr_reader :mms
20
- # @return [Pinnacle::Messages::RcsClient]
21
- attr_reader :rcs
22
13
 
23
14
  # @param request_client [Pinnacle::RequestClient]
24
15
  # @return [Pinnacle::MessagesClient]
25
16
  def initialize(request_client:)
26
17
  @request_client = request_client
27
- @sms = Pinnacle::Messages::SmsClient.new(request_client: request_client)
28
- @mms = Pinnacle::Messages::MmsClient.new(request_client: request_client)
29
- @rcs = Pinnacle::Messages::RcsClient.new(request_client: request_client)
30
18
  end
31
19
 
32
20
  # Retrieve a previously sent message.
33
21
  #
34
- # @param id [Integer] Unique identifier of the message.
22
+ # @param id [String] Unique identifier of the message. This identifier is a string that always begins
23
+ # with the prefix `msg_`, for example: `msg_1234567890`.
35
24
  # @param request_options [Pinnacle::RequestOptions]
36
25
  # @return [Pinnacle::Types::Message]
37
26
  # @example
@@ -40,7 +29,7 @@ module Pinnacle
40
29
  # environment: Pinnacle::Environment::DEFAULT,
41
30
  # api_key: "YOUR_API_KEY"
42
31
  # )
43
- # api.messages.get(id: 1240)
32
+ # api.messages.get(id: "msg_1234567890")
44
33
  def get(id:, request_options: nil)
45
34
  response = @request_client.conn.get do |req|
46
35
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -63,7 +52,8 @@ module Pinnacle
63
52
 
64
53
  # Add or remove an emoji reaction to a previously sent message.
65
54
  #
66
- # @param message_id [Integer] Unique identifier of the message.
55
+ # @param message_id [String] Unique identifier of the message. This identifier is a string that always begins
56
+ # with the prefix `msg_`, for example: `msg_1234567890`.
67
57
  # @param options [Hash] Request of type Pinnacle::Messages::Types::ReactMessageOptions, as a Hash
68
58
  # * :force (Boolean)
69
59
  # @param reaction [String] Unicode emoji to add. <br>
@@ -77,7 +67,7 @@ module Pinnacle
77
67
  # api_key: "YOUR_API_KEY"
78
68
  # )
79
69
  # api.messages.react(
80
- # message_id: 1410,
70
+ # message_id: "msg_1234567890",
81
71
  # options: { force: true },
82
72
  # reaction: "👍"
83
73
  # )
@@ -108,25 +98,17 @@ module Pinnacle
108
98
  class AsyncMessagesClient
109
99
  # @return [Pinnacle::AsyncRequestClient]
110
100
  attr_reader :request_client
111
- # @return [Pinnacle::Messages::AsyncSmsClient]
112
- attr_reader :sms
113
- # @return [Pinnacle::Messages::AsyncMmsClient]
114
- attr_reader :mms
115
- # @return [Pinnacle::Messages::AsyncRcsClient]
116
- attr_reader :rcs
117
101
 
118
102
  # @param request_client [Pinnacle::AsyncRequestClient]
119
103
  # @return [Pinnacle::AsyncMessagesClient]
120
104
  def initialize(request_client:)
121
105
  @request_client = request_client
122
- @sms = Pinnacle::Messages::AsyncSmsClient.new(request_client: request_client)
123
- @mms = Pinnacle::Messages::AsyncMmsClient.new(request_client: request_client)
124
- @rcs = Pinnacle::Messages::AsyncRcsClient.new(request_client: request_client)
125
106
  end
126
107
 
127
108
  # Retrieve a previously sent message.
128
109
  #
129
- # @param id [Integer] Unique identifier of the message.
110
+ # @param id [String] Unique identifier of the message. This identifier is a string that always begins
111
+ # with the prefix `msg_`, for example: `msg_1234567890`.
130
112
  # @param request_options [Pinnacle::RequestOptions]
131
113
  # @return [Pinnacle::Types::Message]
132
114
  # @example
@@ -135,7 +117,7 @@ module Pinnacle
135
117
  # environment: Pinnacle::Environment::DEFAULT,
136
118
  # api_key: "YOUR_API_KEY"
137
119
  # )
138
- # api.messages.get(id: 1240)
120
+ # api.messages.get(id: "msg_1234567890")
139
121
  def get(id:, request_options: nil)
140
122
  Async do
141
123
  response = @request_client.conn.get do |req|
@@ -160,7 +142,8 @@ module Pinnacle
160
142
 
161
143
  # Add or remove an emoji reaction to a previously sent message.
162
144
  #
163
- # @param message_id [Integer] Unique identifier of the message.
145
+ # @param message_id [String] Unique identifier of the message. This identifier is a string that always begins
146
+ # with the prefix `msg_`, for example: `msg_1234567890`.
164
147
  # @param options [Hash] Request of type Pinnacle::Messages::Types::ReactMessageOptions, as a Hash
165
148
  # * :force (Boolean)
166
149
  # @param reaction [String] Unicode emoji to add. <br>
@@ -174,7 +157,7 @@ module Pinnacle
174
157
  # api_key: "YOUR_API_KEY"
175
158
  # )
176
159
  # api.messages.react(
177
- # message_id: 1410,
160
+ # message_id: "msg_1234567890",
178
161
  # options: { force: true },
179
162
  # reaction: "👍"
180
163
  # )
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../../requests"
4
- require_relative "../../types/rcs"
4
+ require_relative "../../types/rich_message"
5
5
  require_relative "types/rcs_send_response"
6
+ require_relative "types/send_typing_indicator_schema_options"
7
+ require_relative "../../types/send_typing_indicator_response"
6
8
  require_relative "../../types/rcs_validate_content"
7
9
  require_relative "../../types/rcs_validation_result"
8
10
  require "async"
@@ -51,6 +53,66 @@ module Pinnacle
51
53
  Pinnacle::Messages::Rcs::Types::RcsSendResponse.from_json(json_object: response.body)
52
54
  end
53
55
 
56
+ # Send a typing indicator from an RCS agent to a recipient.
57
+ # This endpoint allows RCS agents to display a typing indicator to recipients. The
58
+ # indicator is a message bubble with animated typing dots like this: <img
59
+ # le.app/storage/v1/object/public/pinnacle-public-assets/ios-typing-indicator.png"
60
+ # alt="Typing Indicator" style="display: inline; height: 1.5em; vertical-align:
61
+ # middle; margin: 0 4px;" />
62
+ # **Use Case:** Typing indicators are especially useful for providing feedback to
63
+ # users while the agent is thinking or generating a response that may take some
64
+ # time, creating a more engaging conversational experience.
65
+ # **Expiration:** Typing indicators automatically expire after around 20 seconds
66
+ # or when the agent sends a message, whichever comes first.
67
+ # **Frequency:** You can send typing indicators as many times as needed, though
68
+ # only one will be displayed at a time. Sending multiple typing indicators will
69
+ # extend the duration of the current indicator.
70
+ # > **Note:** Typing indicators are best-effort hints, not delivery-guaranteed
71
+ # state. The platform is allowed to coalesce or drop them, and the client UI
72
+ # decides when to show/hide.
73
+ #
74
+ # @param agent_id [String] The unique identifier of the RCS agent sending the typing indicator. <br>
75
+ # Format: `agent_` followed by alphanumeric characters (e.g., `agent_pinnacle`).
76
+ # @param to [String] The recipient's phone number in E.164 format. <br>
77
+ # Must include country code with a leading plus sign (e.g., `+14155551234`).
78
+ # @param options [Hash] Configure how your typing indicator is sent.Request of type Pinnacle::Messages::Rcs::Types::SendTypingIndicatorSchemaOptions, as a Hash
79
+ # * :test_mode (Boolean)
80
+ # @param request_options [Pinnacle::RequestOptions]
81
+ # @return [Pinnacle::Types::SendTypingIndicatorResponse]
82
+ # @example
83
+ # api = Pinnacle::Client.new(
84
+ # base_url: "https://api.example.com",
85
+ # environment: Pinnacle::Environment::DEFAULT,
86
+ # api_key: "YOUR_API_KEY"
87
+ # )
88
+ # api.messages.rcs.send_typing(
89
+ # agent_id: "agent_pinnacle",
90
+ # to: "+14154746461",
91
+ # options: { test_mode: false }
92
+ # )
93
+ def send_typing(agent_id:, to:, options: nil, request_options: nil)
94
+ response = @request_client.conn.post do |req|
95
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
96
+ req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
97
+ req.headers = {
98
+ **(req.headers || {}),
99
+ **@request_client.get_headers,
100
+ **(request_options&.additional_headers || {})
101
+ }.compact
102
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
103
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
104
+ end
105
+ req.body = {
106
+ **(request_options&.additional_body_parameters || {}),
107
+ agentId: agent_id,
108
+ to: to,
109
+ options: options
110
+ }.compact
111
+ req.url "#{@request_client.get_url(request_options: request_options)}/messages/typing"
112
+ end
113
+ Pinnacle::Types::SendTypingIndicatorResponse.from_json(json_object: response.body)
114
+ end
115
+
54
116
  # Validate RCS message content without sending it.
55
117
  #
56
118
  # @param request [Pinnacle::Types::RcsTextContent, Pinnacle::Types::RcsValidateContentMedia, Pinnacle::Types::RcsCards]
@@ -126,6 +188,68 @@ module Pinnacle
126
188
  end
127
189
  end
128
190
 
191
+ # Send a typing indicator from an RCS agent to a recipient.
192
+ # This endpoint allows RCS agents to display a typing indicator to recipients. The
193
+ # indicator is a message bubble with animated typing dots like this: <img
194
+ # le.app/storage/v1/object/public/pinnacle-public-assets/ios-typing-indicator.png"
195
+ # alt="Typing Indicator" style="display: inline; height: 1.5em; vertical-align:
196
+ # middle; margin: 0 4px;" />
197
+ # **Use Case:** Typing indicators are especially useful for providing feedback to
198
+ # users while the agent is thinking or generating a response that may take some
199
+ # time, creating a more engaging conversational experience.
200
+ # **Expiration:** Typing indicators automatically expire after around 20 seconds
201
+ # or when the agent sends a message, whichever comes first.
202
+ # **Frequency:** You can send typing indicators as many times as needed, though
203
+ # only one will be displayed at a time. Sending multiple typing indicators will
204
+ # extend the duration of the current indicator.
205
+ # > **Note:** Typing indicators are best-effort hints, not delivery-guaranteed
206
+ # state. The platform is allowed to coalesce or drop them, and the client UI
207
+ # decides when to show/hide.
208
+ #
209
+ # @param agent_id [String] The unique identifier of the RCS agent sending the typing indicator. <br>
210
+ # Format: `agent_` followed by alphanumeric characters (e.g., `agent_pinnacle`).
211
+ # @param to [String] The recipient's phone number in E.164 format. <br>
212
+ # Must include country code with a leading plus sign (e.g., `+14155551234`).
213
+ # @param options [Hash] Configure how your typing indicator is sent.Request of type Pinnacle::Messages::Rcs::Types::SendTypingIndicatorSchemaOptions, as a Hash
214
+ # * :test_mode (Boolean)
215
+ # @param request_options [Pinnacle::RequestOptions]
216
+ # @return [Pinnacle::Types::SendTypingIndicatorResponse]
217
+ # @example
218
+ # api = Pinnacle::Client.new(
219
+ # base_url: "https://api.example.com",
220
+ # environment: Pinnacle::Environment::DEFAULT,
221
+ # api_key: "YOUR_API_KEY"
222
+ # )
223
+ # api.messages.rcs.send_typing(
224
+ # agent_id: "agent_pinnacle",
225
+ # to: "+14154746461",
226
+ # options: { test_mode: false }
227
+ # )
228
+ def send_typing(agent_id:, to:, options: nil, request_options: nil)
229
+ Async do
230
+ response = @request_client.conn.post do |req|
231
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
232
+ req.headers["PINNACLE-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
233
+ req.headers = {
234
+ **(req.headers || {}),
235
+ **@request_client.get_headers,
236
+ **(request_options&.additional_headers || {})
237
+ }.compact
238
+ unless request_options.nil? || request_options&.additional_query_parameters.nil?
239
+ req.params = { **(request_options&.additional_query_parameters || {}) }.compact
240
+ end
241
+ req.body = {
242
+ **(request_options&.additional_body_parameters || {}),
243
+ agentId: agent_id,
244
+ to: to,
245
+ options: options
246
+ }.compact
247
+ req.url "#{@request_client.get_url(request_options: request_options)}/messages/typing"
248
+ end
249
+ Pinnacle::Types::SendTypingIndicatorResponse.from_json(json_object: response.body)
250
+ end
251
+ end
252
+
129
253
  # Validate RCS message content without sending it.
130
254
  #
131
255
  # @param request [Pinnacle::Types::RcsTextContent, Pinnacle::Types::RcsValidateContentMedia, Pinnacle::Types::RcsCards]
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ostruct"
4
+ require "json"
5
+
6
+ module Pinnacle
7
+ module Messages
8
+ module Rcs
9
+ module Types
10
+ # Configure how your typing indicator is sent.
11
+ class SendTypingIndicatorSchemaOptions
12
+ # @return [Boolean] Send via the test agent to whitelisted test devices. Useful for development and
13
+ # debugging.
14
+ attr_reader :test_mode
15
+ # @return [OpenStruct] Additional properties unmapped to the current class definition
16
+ attr_reader :additional_properties
17
+ # @return [Object]
18
+ attr_reader :_field_set
19
+ protected :_field_set
20
+
21
+ OMIT = Object.new
22
+
23
+ # @param test_mode [Boolean] Send via the test agent to whitelisted test devices. Useful for development and
24
+ # debugging.
25
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
26
+ # @return [Pinnacle::Messages::Rcs::Types::SendTypingIndicatorSchemaOptions]
27
+ def initialize(test_mode: OMIT, additional_properties: nil)
28
+ @test_mode = test_mode if test_mode != OMIT
29
+ @additional_properties = additional_properties
30
+ @_field_set = { "test_mode": test_mode }.reject do |_k, v|
31
+ v == OMIT
32
+ end
33
+ end
34
+
35
+ # Deserialize a JSON object to an instance of SendTypingIndicatorSchemaOptions
36
+ #
37
+ # @param json_object [String]
38
+ # @return [Pinnacle::Messages::Rcs::Types::SendTypingIndicatorSchemaOptions]
39
+ def self.from_json(json_object:)
40
+ struct = JSON.parse(json_object, object_class: OpenStruct)
41
+ parsed_json = JSON.parse(json_object)
42
+ test_mode = parsed_json["test_mode"]
43
+ new(test_mode: test_mode, additional_properties: struct)
44
+ end
45
+
46
+ # Serialize an instance of SendTypingIndicatorSchemaOptions to a JSON object
47
+ #
48
+ # @return [String]
49
+ def to_json(*_args)
50
+ @_field_set&.to_json
51
+ end
52
+
53
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given
54
+ # hash and check each fields type against the current object's property
55
+ # definitions.
56
+ #
57
+ # @param obj [Object]
58
+ # @return [Void]
59
+ def self.validate_raw(obj:)
60
+ obj.test_mode&.is_a?(Boolean) != false || raise("Passed value for field obj.test_mode is not the expected type, validation failed.")
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -18,11 +18,18 @@ module Pinnacle
18
18
  @request_client = request_client
19
19
  end
20
20
 
21
- # Link a phone number to a specific campaign.
21
+ # Link a phone number to a specific campaign. Phone numbers must be linked to a
22
+ # campaign to send messages.
22
23
  #
23
24
  # @param phones [Array<String>] List of phone number (E.164 format).
24
25
  # @param campaign_type [Pinnacle::Types::MessagingProfileEnum]
25
- # @param campaign_id [Integer] Campaign's identifier.
26
+ # @param campaign_id [String] Unique identifier for the campaign. <br>
27
+ # - **TOLL_FREE** campaigns:
28
+ # - Must begin with the prefix `tf_`
29
+ # - Example: `tf_1234567890`
30
+ # - **10DLC** campaigns:
31
+ # - Must begin with the prefix `dlc_`
32
+ # - Example: `dlc_1234567890`
26
33
  # @param request_options [Pinnacle::RequestOptions]
27
34
  # @return [Pinnacle::Types::AttachedPhoneNumberResult]
28
35
  # @example
@@ -34,7 +41,7 @@ module Pinnacle
34
41
  # api.phone_numbers.campaign.attach(
35
42
  # phones: ["+14155550123", "+14155559876", "+14155550111"],
36
43
  # campaign_type: TOLL_FREE,
37
- # campaign_id: 101
44
+ # campaign_id: "tf_1234567890"
38
45
  # )
39
46
  def attach(phones:, campaign_type:, campaign_id:, request_options: nil)
40
47
  response = @request_client.conn.post do |req|
@@ -100,11 +107,18 @@ module Pinnacle
100
107
  @request_client = request_client
101
108
  end
102
109
 
103
- # Link a phone number to a specific campaign.
110
+ # Link a phone number to a specific campaign. Phone numbers must be linked to a
111
+ # campaign to send messages.
104
112
  #
105
113
  # @param phones [Array<String>] List of phone number (E.164 format).
106
114
  # @param campaign_type [Pinnacle::Types::MessagingProfileEnum]
107
- # @param campaign_id [Integer] Campaign's identifier.
115
+ # @param campaign_id [String] Unique identifier for the campaign. <br>
116
+ # - **TOLL_FREE** campaigns:
117
+ # - Must begin with the prefix `tf_`
118
+ # - Example: `tf_1234567890`
119
+ # - **10DLC** campaigns:
120
+ # - Must begin with the prefix `dlc_`
121
+ # - Example: `dlc_1234567890`
108
122
  # @param request_options [Pinnacle::RequestOptions]
109
123
  # @return [Pinnacle::Types::AttachedPhoneNumberResult]
110
124
  # @example
@@ -116,7 +130,7 @@ module Pinnacle
116
130
  # api.phone_numbers.campaign.attach(
117
131
  # phones: ["+14155550123", "+14155559876", "+14155550111"],
118
132
  # campaign_type: TOLL_FREE,
119
- # campaign_id: 101
133
+ # campaign_id: "tf_1234567890"
120
134
  # )
121
135
  def attach(phones:, campaign_type:, campaign_id:, request_options: nil)
122
136
  Async do
@@ -12,25 +12,17 @@ require_relative "../types/purchased_number"
12
12
  require_relative "types/phone_details_schema_level"
13
13
  require_relative "types/retrieve_phone_number_details_options"
14
14
  require_relative "types/phone_numbers_get_response"
15
- require_relative "campaign/client"
16
- require_relative "webhook/client"
17
15
  require "async"
18
16
 
19
17
  module Pinnacle
20
18
  class PhoneNumbersClient
21
19
  # @return [Pinnacle::RequestClient]
22
20
  attr_reader :request_client
23
- # @return [Pinnacle::PhoneNumbers::CampaignClient]
24
- attr_reader :campaign
25
- # @return [Pinnacle::PhoneNumbers::WebhookClient]
26
- attr_reader :webhook
27
21
 
28
22
  # @param request_client [Pinnacle::RequestClient]
29
23
  # @return [Pinnacle::PhoneNumbersClient]
30
24
  def initialize(request_client:)
31
25
  @request_client = request_client
32
- @campaign = Pinnacle::PhoneNumbers::CampaignClient.new(request_client: request_client)
33
- @webhook = Pinnacle::PhoneNumbers::WebhookClient.new(request_client: request_client)
34
26
  end
35
27
 
36
28
  # Search for available phone numbers that match your exact criteria.
@@ -187,17 +179,11 @@ module Pinnacle
187
179
  class AsyncPhoneNumbersClient
188
180
  # @return [Pinnacle::AsyncRequestClient]
189
181
  attr_reader :request_client
190
- # @return [Pinnacle::PhoneNumbers::AsyncCampaignClient]
191
- attr_reader :campaign
192
- # @return [Pinnacle::PhoneNumbers::AsyncWebhookClient]
193
- attr_reader :webhook
194
182
 
195
183
  # @param request_client [Pinnacle::AsyncRequestClient]
196
184
  # @return [Pinnacle::AsyncPhoneNumbersClient]
197
185
  def initialize(request_client:)
198
186
  @request_client = request_client
199
- @campaign = Pinnacle::PhoneNumbers::AsyncCampaignClient.new(request_client: request_client)
200
- @webhook = Pinnacle::PhoneNumbers::AsyncWebhookClient.new(request_client: request_client)
201
187
  end
202
188
 
203
189
  # Search for available phone numbers that match your exact criteria.
@@ -24,7 +24,7 @@ module Pinnacle
24
24
  # @param phone [String] The phone number you want to attach the webhook to in E.164 format. Make sure it
25
25
  # is url encoded (i.e. replace the leading + with %2B). <br>
26
26
  # Must be a phone number that you own and have already [purchased](./buy) through
27
- # the API.
27
+ # the API. A phone number can have multiple webhooks attached to it.
28
28
  # @param request [Pinnacle::Types::AttachWebhookByIdParams, Pinnacle::Types::CreateAndAttachWebhookByUrlParams]
29
29
  # @param request_options [Pinnacle::RequestOptions]
30
30
  # @return [Pinnacle::Types::ConfiguredWebhook]
@@ -34,7 +34,7 @@ module Pinnacle
34
34
  # environment: Pinnacle::Environment::DEFAULT,
35
35
  # api_key: "YOUR_API_KEY"
36
36
  # )
37
- # api.phone_numbers.webhook.attach(phone: "%2B14155551234", request: { webhook_id: 1 })
37
+ # api.phone_numbers.webhook.attach(phone: "%2B14155551234", request: { webhook_id: "wh_1234567890", event: MESSAGE_STATUS })
38
38
  def attach(phone:, request:, request_options: nil)
39
39
  response = @request_client.conn.post do |req|
40
40
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -62,10 +62,11 @@ module Pinnacle
62
62
  # is url encoded (i.e. replace the leading + with %2B). <br>
63
63
  # Must be a phone number that you own and currently has the specified webhook
64
64
  # attached.
65
- # @param webhook_id [Integer] The unique identifier of the webhook you want to detach from the phone number.
65
+ # @param webhook_id [String] The unique identifier of the webhook you want to detach from the phone number.
66
66
  # <br>
67
67
  # This must be a valid webhook ID that is currently attached to the specified
68
- # phone number.
68
+ # phone number. This identifier is a string that always begins with the prefix
69
+ # `wh_`, for example: `wh_1234567890`.
69
70
  # @param request_options [Pinnacle::RequestOptions]
70
71
  # @return [Pinnacle::Types::DetachedWebhookInfo]
71
72
  # @example
@@ -74,7 +75,7 @@ module Pinnacle
74
75
  # environment: Pinnacle::Environment::DEFAULT,
75
76
  # api_key: "YOUR_API_KEY"
76
77
  # )
77
- # api.phone_numbers.webhook.detach(phone: "+14155551234", webhook_id: 123)
78
+ # api.phone_numbers.webhook.detach(phone: "+14155551234", webhook_id: "wh_1234567890")
78
79
  def detach(phone:, webhook_id:, request_options: nil)
79
80
  response = @request_client.conn.delete do |req|
80
81
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -112,7 +113,7 @@ module Pinnacle
112
113
  # @param phone [String] The phone number you want to attach the webhook to in E.164 format. Make sure it
113
114
  # is url encoded (i.e. replace the leading + with %2B). <br>
114
115
  # Must be a phone number that you own and have already [purchased](./buy) through
115
- # the API.
116
+ # the API. A phone number can have multiple webhooks attached to it.
116
117
  # @param request [Pinnacle::Types::AttachWebhookByIdParams, Pinnacle::Types::CreateAndAttachWebhookByUrlParams]
117
118
  # @param request_options [Pinnacle::RequestOptions]
118
119
  # @return [Pinnacle::Types::ConfiguredWebhook]
@@ -122,7 +123,7 @@ module Pinnacle
122
123
  # environment: Pinnacle::Environment::DEFAULT,
123
124
  # api_key: "YOUR_API_KEY"
124
125
  # )
125
- # api.phone_numbers.webhook.attach(phone: "%2B14155551234", request: { webhook_id: 1 })
126
+ # api.phone_numbers.webhook.attach(phone: "%2B14155551234", request: { webhook_id: "wh_1234567890", event: MESSAGE_STATUS })
126
127
  def attach(phone:, request:, request_options: nil)
127
128
  Async do
128
129
  response = @request_client.conn.post do |req|
@@ -152,10 +153,11 @@ module Pinnacle
152
153
  # is url encoded (i.e. replace the leading + with %2B). <br>
153
154
  # Must be a phone number that you own and currently has the specified webhook
154
155
  # attached.
155
- # @param webhook_id [Integer] The unique identifier of the webhook you want to detach from the phone number.
156
+ # @param webhook_id [String] The unique identifier of the webhook you want to detach from the phone number.
156
157
  # <br>
157
158
  # This must be a valid webhook ID that is currently attached to the specified
158
- # phone number.
159
+ # phone number. This identifier is a string that always begins with the prefix
160
+ # `wh_`, for example: `wh_1234567890`.
159
161
  # @param request_options [Pinnacle::RequestOptions]
160
162
  # @return [Pinnacle::Types::DetachedWebhookInfo]
161
163
  # @example
@@ -164,7 +166,7 @@ module Pinnacle
164
166
  # environment: Pinnacle::Environment::DEFAULT,
165
167
  # api_key: "YOUR_API_KEY"
166
168
  # )
167
- # api.phone_numbers.webhook.detach(phone: "+14155551234", webhook_id: 123)
169
+ # api.phone_numbers.webhook.detach(phone: "+14155551234", webhook_id: "wh_1234567890")
168
170
  def detach(phone:, webhook_id:, request_options: nil)
169
171
  Async do
170
172
  response = @request_client.conn.delete do |req|
@@ -59,23 +59,30 @@ module Pinnacle
59
59
  # ## Overview
60
60
  # During development and testing, RCS agents can only send messages to whitelisted
61
61
  # phone numbers.
62
- # Use this endpoint to add test devices to your agent's whitelist before sending
63
- # test messages.
62
+ # Use this endpoint to whitelist specific phone numbers to send and receive
63
+ # messages from the test agent.
64
64
  # ## Verification Process
65
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:
66
+ # 1. Check the test device for message from "RBM Tester Management"
67
+ # 2. Click the "Make me a tester" button
68
+ # 3. Enter the separate 4-digit verification SMS code in the Pinnacle dashboard
69
+ # at:
69
70
  # ```
70
71
  # .pinnacle.sh/dashboard/brands/{brandId}?campaignId={campaignId}&campaignType=RCS
71
72
  # ```
73
+ # > **⚠️ Important: Re-whitelisting Numbers**
74
+ # >
75
+ # > If you whitelist a number that's already whitelisted, you'll receive a new
76
+ # message from "RBM Tester Management". **You must click the "Make me a tester"
77
+ # button again to continue sending and receiving messages.**
72
78
  # > **Important Notes**
73
79
  # >
80
+ # > - **Verification required:** Messages cannot be sent nor received until you
81
+ # have clicked the "Make me a tester" button on the test device.
74
82
  # > - **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.
83
+ # can message any RCS-enabled number.
84
+ # > - **Network limitations:** Whitelisting may be temporarily unavailable for
85
+ # some carriers but are usually restored shortly.
79
86
  #
80
87
  # @param agent_id [String] The RCS agent ID (must be prefixed with 'agent_')
81
88
  # @param phone_number [String] Phone number to whitelist for testing (E.164 format)
@@ -211,23 +218,30 @@ module Pinnacle
211
218
  # ## Overview
212
219
  # During development and testing, RCS agents can only send messages to whitelisted
213
220
  # phone numbers.
214
- # Use this endpoint to add test devices to your agent's whitelist before sending
215
- # test messages.
221
+ # Use this endpoint to whitelist specific phone numbers to send and receive
222
+ # messages from the test agent.
216
223
  # ## Verification Process
217
224
  # 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:
225
+ # 1. Check the test device for message from "RBM Tester Management"
226
+ # 2. Click the "Make me a tester" button
227
+ # 3. Enter the separate 4-digit verification SMS code in the Pinnacle dashboard
228
+ # at:
221
229
  # ```
222
230
  # .pinnacle.sh/dashboard/brands/{brandId}?campaignId={campaignId}&campaignType=RCS
223
231
  # ```
232
+ # > **⚠️ Important: Re-whitelisting Numbers**
233
+ # >
234
+ # > If you whitelist a number that's already whitelisted, you'll receive a new
235
+ # message from "RBM Tester Management". **You must click the "Make me a tester"
236
+ # button again to continue sending and receiving messages.**
224
237
  # > **Important Notes**
225
238
  # >
239
+ # > - **Verification required:** Messages cannot be sent nor received until you
240
+ # have clicked the "Make me a tester" button on the test device.
226
241
  # > - **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.
242
+ # can message any RCS-enabled number.
243
+ # > - **Network limitations:** Whitelisting may be temporarily unavailable for
244
+ # some carriers but are usually restored shortly.
231
245
  #
232
246
  # @param agent_id [String] The RCS agent ID (must be prefixed with 'agent_')
233
247
  # @param phone_number [String] Phone number to whitelist for testing (E.164 format)