surge_api 0.1.0 → 0.2.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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/README.md +12 -63
  4. data/lib/surge_api/file_part.rb +10 -7
  5. data/lib/surge_api/internal/transport/pooled_net_requester.rb +34 -31
  6. data/lib/surge_api/internal/type/file_input.rb +7 -4
  7. data/lib/surge_api/internal/type/union.rb +1 -1
  8. data/lib/surge_api/internal/util.rb +5 -5
  9. data/lib/surge_api/models/account_create_params.rb +13 -6
  10. data/lib/surge_api/models/account_update_params.rb +13 -6
  11. data/lib/surge_api/models/campaign_create_params.rb +7 -183
  12. data/lib/surge_api/models/campaign_params.rb +228 -0
  13. data/lib/surge_api/models/contact_opted_in_webhook_event.rb +54 -0
  14. data/lib/surge_api/models/contact_opted_out_webhook_event.rb +54 -0
  15. data/lib/surge_api/models/message_create_params.rb +8 -134
  16. data/lib/surge_api/models/message_params.rb +216 -0
  17. data/lib/surge_api/models/unwrap_webhook_event.rb +5 -1
  18. data/lib/surge_api/models.rb +8 -0
  19. data/lib/surge_api/resources/campaigns.rb +7 -18
  20. data/lib/surge_api/resources/messages.rb +7 -12
  21. data/lib/surge_api/resources/webhooks.rb +1 -1
  22. data/lib/surge_api/version.rb +1 -1
  23. data/lib/surge_api.rb +4 -0
  24. data/rbi/surge_api/file_part.rbi +1 -1
  25. data/rbi/surge_api/models/account_create_params.rbi +19 -8
  26. data/rbi/surge_api/models/account_update_params.rbi +19 -8
  27. data/rbi/surge_api/models/campaign_create_params.rbi +20 -346
  28. data/rbi/surge_api/models/campaign_params.rbi +481 -0
  29. data/rbi/surge_api/models/contact_opted_in_webhook_event.rbi +95 -0
  30. data/rbi/surge_api/models/contact_opted_out_webhook_event.rbi +95 -0
  31. data/rbi/surge_api/models/message_create_params.rbi +24 -243
  32. data/rbi/surge_api/models/message_params.rbi +430 -0
  33. data/rbi/surge_api/models/unwrap_webhook_event.rbi +2 -0
  34. data/rbi/surge_api/models.rbi +8 -0
  35. data/rbi/surge_api/resources/campaigns.rbi +4 -89
  36. data/rbi/surge_api/resources/messages.rbi +5 -22
  37. data/rbi/surge_api/resources/webhooks.rbi +2 -0
  38. data/sig/surge_api/file_part.rbs +1 -1
  39. data/sig/surge_api/models/campaign_create_params.rbs +7 -106
  40. data/sig/surge_api/models/campaign_params.rbs +141 -0
  41. data/sig/surge_api/models/contact_opted_in_webhook_event.rbs +45 -0
  42. data/sig/surge_api/models/contact_opted_out_webhook_event.rbs +45 -0
  43. data/sig/surge_api/models/message_create_params.rbs +7 -119
  44. data/sig/surge_api/models/message_params.rbs +189 -0
  45. data/sig/surge_api/models/unwrap_webhook_event.rbs +2 -0
  46. data/sig/surge_api/models.rbs +8 -0
  47. data/sig/surge_api/resources/campaigns.rbs +1 -9
  48. data/sig/surge_api/resources/messages.rbs +1 -6
  49. data/sig/surge_api/resources/webhooks.rbs +2 -0
  50. metadata +14 -2
@@ -0,0 +1,430 @@
1
+ # typed: strong
2
+
3
+ module SurgeAPI
4
+ module Models
5
+ # Payload for creating a message. Either an attachment or the body must be given.
6
+ # You can specify the recipient either using the 'conversation' parameter or the
7
+ # 'to'/'from' parameters, but not both.
8
+ module MessageParams
9
+ extend SurgeAPI::Internal::Type::Union
10
+
11
+ Variants =
12
+ T.type_alias do
13
+ T.any(
14
+ SurgeAPI::MessageParams::MessageParamsWithConversation,
15
+ SurgeAPI::MessageParams::SimpleMessageParams
16
+ )
17
+ end
18
+
19
+ class MessageParamsWithConversation < SurgeAPI::Internal::Type::BaseModel
20
+ OrHash =
21
+ T.type_alias do
22
+ T.any(
23
+ SurgeAPI::MessageParams::MessageParamsWithConversation,
24
+ SurgeAPI::Internal::AnyHash
25
+ )
26
+ end
27
+
28
+ # Params for selecting or creating a new conversation. Either the id or the
29
+ # Contact must be given.
30
+ sig do
31
+ returns(
32
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation
33
+ )
34
+ end
35
+ attr_reader :conversation
36
+
37
+ sig do
38
+ params(
39
+ conversation:
40
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation::OrHash
41
+ ).void
42
+ end
43
+ attr_writer :conversation
44
+
45
+ sig do
46
+ returns(
47
+ T.nilable(
48
+ T::Array[
49
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Attachment
50
+ ]
51
+ )
52
+ )
53
+ end
54
+ attr_reader :attachments
55
+
56
+ sig do
57
+ params(
58
+ attachments:
59
+ T::Array[
60
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Attachment::OrHash
61
+ ]
62
+ ).void
63
+ end
64
+ attr_writer :attachments
65
+
66
+ # The message body.
67
+ sig { returns(T.nilable(String)) }
68
+ attr_reader :body
69
+
70
+ sig { params(body: String).void }
71
+ attr_writer :body
72
+
73
+ # An optional datetime for scheduling message up to a couple of months in the
74
+ # future.
75
+ sig { returns(T.nilable(Time)) }
76
+ attr_reader :send_at
77
+
78
+ sig { params(send_at: Time).void }
79
+ attr_writer :send_at
80
+
81
+ # Create a message while including parameters for the conversation in which the
82
+ # message should be sent.
83
+ sig do
84
+ params(
85
+ conversation:
86
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation::OrHash,
87
+ attachments:
88
+ T::Array[
89
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Attachment::OrHash
90
+ ],
91
+ body: String,
92
+ send_at: Time
93
+ ).returns(T.attached_class)
94
+ end
95
+ def self.new(
96
+ # Params for selecting or creating a new conversation. Either the id or the
97
+ # Contact must be given.
98
+ conversation:,
99
+ attachments: nil,
100
+ # The message body.
101
+ body: nil,
102
+ # An optional datetime for scheduling message up to a couple of months in the
103
+ # future.
104
+ send_at: nil
105
+ )
106
+ end
107
+
108
+ sig do
109
+ override.returns(
110
+ {
111
+ conversation:
112
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation,
113
+ attachments:
114
+ T::Array[
115
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Attachment
116
+ ],
117
+ body: String,
118
+ send_at: Time
119
+ }
120
+ )
121
+ end
122
+ def to_hash
123
+ end
124
+
125
+ class Conversation < SurgeAPI::Internal::Type::BaseModel
126
+ OrHash =
127
+ T.type_alias do
128
+ T.any(
129
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation,
130
+ SurgeAPI::Internal::AnyHash
131
+ )
132
+ end
133
+
134
+ # Parameters for creating a contact
135
+ sig do
136
+ returns(
137
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation::Contact
138
+ )
139
+ end
140
+ attr_reader :contact
141
+
142
+ sig do
143
+ params(
144
+ contact:
145
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation::Contact::OrHash
146
+ ).void
147
+ end
148
+ attr_writer :contact
149
+
150
+ # The phone number from which to send the message. This can be either the phone
151
+ # number in E.164 format or a Surge phone number id.
152
+ sig { returns(T.nilable(String)) }
153
+ attr_reader :phone_number
154
+
155
+ sig { params(phone_number: String).void }
156
+ attr_writer :phone_number
157
+
158
+ # Params for selecting or creating a new conversation. Either the id or the
159
+ # Contact must be given.
160
+ sig do
161
+ params(
162
+ contact:
163
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation::Contact::OrHash,
164
+ phone_number: String
165
+ ).returns(T.attached_class)
166
+ end
167
+ def self.new(
168
+ # Parameters for creating a contact
169
+ contact:,
170
+ # The phone number from which to send the message. This can be either the phone
171
+ # number in E.164 format or a Surge phone number id.
172
+ phone_number: nil
173
+ )
174
+ end
175
+
176
+ sig do
177
+ override.returns(
178
+ {
179
+ contact:
180
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation::Contact,
181
+ phone_number: String
182
+ }
183
+ )
184
+ end
185
+ def to_hash
186
+ end
187
+
188
+ class Contact < SurgeAPI::Internal::Type::BaseModel
189
+ OrHash =
190
+ T.type_alias do
191
+ T.any(
192
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Conversation::Contact,
193
+ SurgeAPI::Internal::AnyHash
194
+ )
195
+ end
196
+
197
+ # The contact's phone number in E.164 format.
198
+ sig { returns(String) }
199
+ attr_accessor :phone_number
200
+
201
+ # The contact's email address.
202
+ sig { returns(T.nilable(String)) }
203
+ attr_reader :email
204
+
205
+ sig { params(email: String).void }
206
+ attr_writer :email
207
+
208
+ # The contact's first name.
209
+ sig { returns(T.nilable(String)) }
210
+ attr_reader :first_name
211
+
212
+ sig { params(first_name: String).void }
213
+ attr_writer :first_name
214
+
215
+ # The contact's last name.
216
+ sig { returns(T.nilable(String)) }
217
+ attr_reader :last_name
218
+
219
+ sig { params(last_name: String).void }
220
+ attr_writer :last_name
221
+
222
+ # Set of key-value pairs that will be stored with the object.
223
+ sig { returns(T.nilable(T::Hash[Symbol, String])) }
224
+ attr_reader :metadata
225
+
226
+ sig { params(metadata: T::Hash[Symbol, String]).void }
227
+ attr_writer :metadata
228
+
229
+ # Parameters for creating a contact
230
+ sig do
231
+ params(
232
+ phone_number: String,
233
+ email: String,
234
+ first_name: String,
235
+ last_name: String,
236
+ metadata: T::Hash[Symbol, String]
237
+ ).returns(T.attached_class)
238
+ end
239
+ def self.new(
240
+ # The contact's phone number in E.164 format.
241
+ phone_number:,
242
+ # The contact's email address.
243
+ email: nil,
244
+ # The contact's first name.
245
+ first_name: nil,
246
+ # The contact's last name.
247
+ last_name: nil,
248
+ # Set of key-value pairs that will be stored with the object.
249
+ metadata: nil
250
+ )
251
+ end
252
+
253
+ sig do
254
+ override.returns(
255
+ {
256
+ phone_number: String,
257
+ email: String,
258
+ first_name: String,
259
+ last_name: String,
260
+ metadata: T::Hash[Symbol, String]
261
+ }
262
+ )
263
+ end
264
+ def to_hash
265
+ end
266
+ end
267
+ end
268
+
269
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
270
+ OrHash =
271
+ T.type_alias do
272
+ T.any(
273
+ SurgeAPI::MessageParams::MessageParamsWithConversation::Attachment,
274
+ SurgeAPI::Internal::AnyHash
275
+ )
276
+ end
277
+
278
+ # The URL of the attachment.
279
+ sig { returns(String) }
280
+ attr_accessor :url
281
+
282
+ # Params for creating an attachment
283
+ sig { params(url: String).returns(T.attached_class) }
284
+ def self.new(
285
+ # The URL of the attachment.
286
+ url:
287
+ )
288
+ end
289
+
290
+ sig { override.returns({ url: String }) }
291
+ def to_hash
292
+ end
293
+ end
294
+ end
295
+
296
+ class SimpleMessageParams < SurgeAPI::Internal::Type::BaseModel
297
+ OrHash =
298
+ T.type_alias do
299
+ T.any(
300
+ SurgeAPI::MessageParams::SimpleMessageParams,
301
+ SurgeAPI::Internal::AnyHash
302
+ )
303
+ end
304
+
305
+ # The recipient's phone number in E.164 format. Cannot be used together with
306
+ # 'conversation'.
307
+ sig { returns(String) }
308
+ attr_accessor :to
309
+
310
+ sig do
311
+ returns(
312
+ T.nilable(
313
+ T::Array[SurgeAPI::MessageParams::SimpleMessageParams::Attachment]
314
+ )
315
+ )
316
+ end
317
+ attr_reader :attachments
318
+
319
+ sig do
320
+ params(
321
+ attachments:
322
+ T::Array[
323
+ SurgeAPI::MessageParams::SimpleMessageParams::Attachment::OrHash
324
+ ]
325
+ ).void
326
+ end
327
+ attr_writer :attachments
328
+
329
+ # The message body.
330
+ sig { returns(T.nilable(String)) }
331
+ attr_reader :body
332
+
333
+ sig { params(body: String).void }
334
+ attr_writer :body
335
+
336
+ # The sender's phone number in E.164 format or phone number ID. If omitted, uses
337
+ # the account's default phone number. Cannot be used together with 'conversation'.
338
+ sig { returns(T.nilable(String)) }
339
+ attr_reader :from
340
+
341
+ sig { params(from: String).void }
342
+ attr_writer :from
343
+
344
+ # An optional datetime for scheduling message up to a couple of months in the
345
+ # future.
346
+ sig { returns(T.nilable(Time)) }
347
+ attr_reader :send_at
348
+
349
+ sig { params(send_at: Time).void }
350
+ attr_writer :send_at
351
+
352
+ # Create a basic message by specifying just the to/from phone numbers.
353
+ sig do
354
+ params(
355
+ to: String,
356
+ attachments:
357
+ T::Array[
358
+ SurgeAPI::MessageParams::SimpleMessageParams::Attachment::OrHash
359
+ ],
360
+ body: String,
361
+ from: String,
362
+ send_at: Time
363
+ ).returns(T.attached_class)
364
+ end
365
+ def self.new(
366
+ # The recipient's phone number in E.164 format. Cannot be used together with
367
+ # 'conversation'.
368
+ to:,
369
+ attachments: nil,
370
+ # The message body.
371
+ body: nil,
372
+ # The sender's phone number in E.164 format or phone number ID. If omitted, uses
373
+ # the account's default phone number. Cannot be used together with 'conversation'.
374
+ from: nil,
375
+ # An optional datetime for scheduling message up to a couple of months in the
376
+ # future.
377
+ send_at: nil
378
+ )
379
+ end
380
+
381
+ sig do
382
+ override.returns(
383
+ {
384
+ to: String,
385
+ attachments:
386
+ T::Array[
387
+ SurgeAPI::MessageParams::SimpleMessageParams::Attachment
388
+ ],
389
+ body: String,
390
+ from: String,
391
+ send_at: Time
392
+ }
393
+ )
394
+ end
395
+ def to_hash
396
+ end
397
+
398
+ class Attachment < SurgeAPI::Internal::Type::BaseModel
399
+ OrHash =
400
+ T.type_alias do
401
+ T.any(
402
+ SurgeAPI::MessageParams::SimpleMessageParams::Attachment,
403
+ SurgeAPI::Internal::AnyHash
404
+ )
405
+ end
406
+
407
+ # The URL of the attachment.
408
+ sig { returns(String) }
409
+ attr_accessor :url
410
+
411
+ # Params for creating an attachment
412
+ sig { params(url: String).returns(T.attached_class) }
413
+ def self.new(
414
+ # The URL of the attachment.
415
+ url:
416
+ )
417
+ end
418
+
419
+ sig { override.returns({ url: String }) }
420
+ def to_hash
421
+ end
422
+ end
423
+ end
424
+
425
+ sig { override.returns(T::Array[SurgeAPI::MessageParams::Variants]) }
426
+ def self.variants
427
+ end
428
+ end
429
+ end
430
+ end
@@ -10,6 +10,8 @@ module SurgeAPI
10
10
  T.any(
11
11
  SurgeAPI::CallEndedWebhookEvent,
12
12
  SurgeAPI::CampaignApprovedWebhookEvent,
13
+ SurgeAPI::ContactOptedInWebhookEvent,
14
+ SurgeAPI::ContactOptedOutWebhookEvent,
13
15
  SurgeAPI::ConversationCreatedWebhookEvent,
14
16
  SurgeAPI::MessageDeliveredWebhookEvent,
15
17
  SurgeAPI::MessageFailedWebhookEvent,
@@ -23,10 +23,16 @@ module SurgeAPI
23
23
 
24
24
  CampaignCreateParams = SurgeAPI::Models::CampaignCreateParams
25
25
 
26
+ CampaignParams = SurgeAPI::Models::CampaignParams
27
+
26
28
  Contact = SurgeAPI::Models::Contact
27
29
 
28
30
  ContactCreateParams = SurgeAPI::Models::ContactCreateParams
29
31
 
32
+ ContactOptedInWebhookEvent = SurgeAPI::Models::ContactOptedInWebhookEvent
33
+
34
+ ContactOptedOutWebhookEvent = SurgeAPI::Models::ContactOptedOutWebhookEvent
35
+
30
36
  ContactRetrieveParams = SurgeAPI::Models::ContactRetrieveParams
31
37
 
32
38
  ContactUpdateParams = SurgeAPI::Models::ContactUpdateParams
@@ -44,6 +50,8 @@ module SurgeAPI
44
50
 
45
51
  MessageFailedWebhookEvent = SurgeAPI::Models::MessageFailedWebhookEvent
46
52
 
53
+ MessageParams = SurgeAPI::Models::MessageParams
54
+
47
55
  MessageReceivedWebhookEvent = SurgeAPI::Models::MessageReceivedWebhookEvent
48
56
 
49
57
  MessageSentWebhookEvent = SurgeAPI::Models::MessageSentWebhookEvent
@@ -7,101 +7,16 @@ module SurgeAPI
7
7
  sig do
8
8
  params(
9
9
  account_id: String,
10
- consent_flow: String,
11
- description: String,
12
- message_samples: T::Array[String],
13
- privacy_policy_url: String,
14
- use_cases:
15
- T::Array[SurgeAPI::CampaignCreateParams::UseCase::OrSymbol],
16
- volume: SurgeAPI::CampaignCreateParams::Volume::OrSymbol,
17
- includes: T::Array[SurgeAPI::CampaignCreateParams::Include::OrSymbol],
18
- link_sample: String,
19
- terms_and_conditions_url: String,
10
+ campaign_params: SurgeAPI::CampaignParams,
20
11
  request_options: SurgeAPI::RequestOptions::OrHash
21
12
  ).returns(SurgeAPI::Campaign)
22
13
  end
23
14
  def create(
24
15
  # The account for which the campaign should be created.
25
16
  account_id,
26
- # A string explaining the method through which end users will opt in to receive
27
- # messages from the brand. Typically this should include URLs for opt-in forms or
28
- # screenshots that might be helpful in explaining the flow to someone unfamiliar
29
- # with the organization's purpose.
30
- consent_flow:,
31
- # An explanation of the organization's purpose and how it will be using text
32
- # messaging to accomplish that purpose.
33
- description:,
34
- # An array of 2-5 strings with examples of the messages that will be sent from
35
- # this campaign. Typically the first sample should be a compliance message like
36
- # `You are now opted in to messages from {brand name}. Frequency varies. Msg&data rates apply. Reply STOP to opt out.`
37
- # These samples don't necessarily need to be the only templates that will be used
38
- # for the campaign, but they should reflect the purpose of the messages that will
39
- # be sent. Any variable content can be reflected by wrapping it in square brackets
40
- # like `[customer name]`.
41
- message_samples:,
42
- # The URL of the privacy policy for the brand in question. This may be a shared
43
- # privacy policy if it's the policy that is displayed to end users when they opt
44
- # in to messaging.
45
- privacy_policy_url:,
46
- # A list containing 1-5 types of messages that will be sent with this campaign.
47
- #
48
- # The following use cases are typically available to all brands:
49
- #
50
- # - `account_notification` - For sending reminders, alerts, and general
51
- # account-related notifications like booking confirmations or appointment
52
- # reminders.
53
- # - `customer_care` - For account support, troubleshooting, and general customer
54
- # service communication.
55
- # - `delivery_notification` - For notifying customers about the status of product
56
- # or service deliveries.
57
- # - `fraud_alert` - For warning customers about suspicious or potentially
58
- # fraudulent activity.
59
- # - `higher_education` - For messaging related to colleges, universities, and
60
- # school districts outside of K–12.
61
- # - `marketing` - For promotional or advertising messages intended to market
62
- # products or services.
63
- # - `polling_voting` - For conducting surveys, polls, or voting-related messaging.
64
- # - `public_service_announcement` - For raising awareness about social issues or
65
- # important public information.
66
- # - `security_alert` - For alerts related to potential security breaches or
67
- # compromised systems requiring user action.
68
- # - `two_factor_authentication` - For sending one-time passwords or verification
69
- # codes for login or password reset.
70
- #
71
- # For access to special use cases not shown here, reach out to support@surge.app.
72
- use_cases:,
73
- # This will be one of the following:
74
- #
75
- # - `low` - The campaign will be allowed to send up to 2000 SMS segments to
76
- # T-Mobile customers each day. In this case your platform will be charged for
77
- # the setup fee for a low volume number upon receipt of the API request.
78
- # - `high` - The campaign will be allowed to send up to 200k SMS segments to
79
- # T-Mobile customers each day, depending on the trust score assigned by The
80
- # Campaign Registry. Your platform will be charged for the setup fee for a high
81
- # volume number upon receipt of the API request, and phone numbers will be
82
- # charged as high volume numbers going forward.
83
- volume:,
84
- # A list of properties that this campaign should include. These properties can be
85
- # any of the following values:
86
- #
87
- # - `links` - whether the campaign might send links in messages
88
- # - `phone_numbers` - whether the campaign might send phone numbers in messages
89
- # - `age_gated` - whether the campaign contains age gated content (controlled
90
- # substances or adult content)
91
- # - `direct_lending` - whether the campaign contains content related to direct
92
- # lending or other loan arrangements
93
- includes: nil,
94
- # A sample link that might be sent by this campaign. If links from other domains
95
- # are sent through this campaign, they are much more likely to be filtered by the
96
- # carriers. If link shortening is enabled for the account, the link shortener URL
97
- # will be used instead of what is provided. Reach out to support if you would like
98
- # to disable automatic link shortening.
99
- link_sample: nil,
100
- # The URL of the terms and conditions presented to end users when they opt in to
101
- # messaging. These terms and conditions may be shared among all of a platform's
102
- # customers if they're the terms that are presented to end users when they opt in
103
- # to messaging.
104
- terms_and_conditions_url: nil,
17
+ # Parameters for creating a new campaign. Either provide full campaign details or
18
+ # import using a TCR ID.
19
+ campaign_params:,
105
20
  request_options: {}
106
21
  )
107
22
  end
@@ -31,34 +31,17 @@ module SurgeAPI
31
31
  sig do
32
32
  params(
33
33
  account_id: String,
34
- conversation: SurgeAPI::MessageCreateParams::Conversation::OrHash,
35
- to: String,
36
- attachments:
37
- T::Array[SurgeAPI::MessageCreateParams::Attachment::OrHash],
38
- body: String,
39
- send_at: Time,
40
- from: String,
34
+ message_params: SurgeAPI::MessageParams,
41
35
  request_options: SurgeAPI::RequestOptions::OrHash
42
36
  ).returns(SurgeAPI::Message)
43
37
  end
44
38
  def create(
45
39
  # The account from which the message should be sent.
46
40
  account_id,
47
- # Params for selecting or creating a new conversation. Either the id or the
48
- # Contact must be given.
49
- conversation:,
50
- # The recipient's phone number in E.164 format. Cannot be used together with
51
- # 'conversation'.
52
- to:,
53
- attachments: nil,
54
- # The message body.
55
- body: nil,
56
- # An optional datetime for scheduling message up to a couple of months in the
57
- # future.
58
- send_at: nil,
59
- # The sender's phone number in E.164 format or phone number ID. If omitted, uses
60
- # the account's default phone number. Cannot be used together with 'conversation'.
61
- from: nil,
41
+ # Payload for creating a message. Either an attachment or the body must be given.
42
+ # You can specify the recipient either using the 'conversation' parameter or the
43
+ # 'to'/'from' parameters, but not both.
44
+ message_params:,
62
45
  request_options: {}
63
46
  )
64
47
  end
@@ -8,6 +8,8 @@ module SurgeAPI
8
8
  T.any(
9
9
  SurgeAPI::CallEndedWebhookEvent,
10
10
  SurgeAPI::CampaignApprovedWebhookEvent,
11
+ SurgeAPI::ContactOptedInWebhookEvent,
12
+ SurgeAPI::ContactOptedOutWebhookEvent,
11
13
  SurgeAPI::ConversationCreatedWebhookEvent,
12
14
  SurgeAPI::MessageDeliveredWebhookEvent,
13
15
  SurgeAPI::MessageFailedWebhookEvent,
@@ -14,7 +14,7 @@ module SurgeAPI
14
14
 
15
15
  def initialize: (
16
16
  Pathname | StringIO | IO | String content,
17
- ?filename: String?,
17
+ ?filename: (Pathname | String)?,
18
18
  ?content_type: String?
19
19
  ) -> void
20
20
  end