prelude-sdk 0.3.0 → 0.4.0

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/README.md +1 -1
  4. data/lib/prelude_sdk/client.rb +15 -1
  5. data/lib/prelude_sdk/internal/util.rb +22 -7
  6. data/lib/prelude_sdk/models/notify_send_batch_params.rb +38 -15
  7. data/lib/prelude_sdk/models/notify_send_params.rb +74 -14
  8. data/lib/prelude_sdk/models/transactional_send_params.rb +37 -15
  9. data/lib/prelude_sdk/models/verification_create_response.rb +51 -1
  10. data/lib/prelude_sdk/models/watch_send_events_params.rb +6 -2
  11. data/lib/prelude_sdk/models/watch_send_feedbacks_params.rb +6 -2
  12. data/lib/prelude_sdk/resources/notify.rb +9 -5
  13. data/lib/prelude_sdk/resources/transactional.rb +1 -1
  14. data/lib/prelude_sdk/resources/watch.rb +8 -2
  15. data/lib/prelude_sdk/version.rb +1 -1
  16. data/rbi/prelude_sdk/internal/util.rbi +8 -0
  17. data/rbi/prelude_sdk/models/notify_send_batch_params.rbi +55 -17
  18. data/rbi/prelude_sdk/models/notify_send_params.rbi +114 -17
  19. data/rbi/prelude_sdk/models/transactional_send_params.rbi +50 -17
  20. data/rbi/prelude_sdk/models/verification_create_response.rbi +152 -0
  21. data/rbi/prelude_sdk/models/watch_send_events_params.rbi +4 -2
  22. data/rbi/prelude_sdk/models/watch_send_feedbacks_params.rbi +4 -2
  23. data/rbi/prelude_sdk/resources/notify.rbi +31 -6
  24. data/rbi/prelude_sdk/resources/transactional.rbi +10 -2
  25. data/rbi/prelude_sdk/resources/watch.rbi +4 -2
  26. data/sig/prelude_sdk/internal/util.rbs +4 -0
  27. data/sig/prelude_sdk/models/notify_send_batch_params.rbs +9 -6
  28. data/sig/prelude_sdk/models/notify_send_params.rbs +35 -6
  29. data/sig/prelude_sdk/models/transactional_send_params.rbs +7 -5
  30. data/sig/prelude_sdk/models/verification_create_response.rbs +38 -0
  31. data/sig/prelude_sdk/resources/notify.rbs +2 -0
  32. metadata +2 -2
@@ -156,10 +156,10 @@ module PreludeSDK
156
156
  # Some parameter documentations has been truncated, see
157
157
  # {PreludeSDK::Models::NotifySendParams} for more details.
158
158
  #
159
- # Send transactional and marketing messages to your users via SMS and WhatsApp
160
- # with automatic compliance enforcement.
159
+ # Send transactional and marketing messages to your users via SMS, RCS and
160
+ # WhatsApp with automatic compliance enforcement.
161
161
  #
162
- # @overload send_(template_id:, to:, callback_url: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, variables: nil, request_options: {})
162
+ # @overload send_(template_id:, to:, callback_url: nil, context: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, text: nil, variables: nil, request_options: {})
163
163
  #
164
164
  # @param template_id [String] The template identifier configured by your Customer Success team.
165
165
  #
@@ -167,9 +167,11 @@ module PreludeSDK
167
167
  #
168
168
  # @param callback_url [String] The URL where webhooks will be sent for message delivery events.
169
169
  #
170
+ # @param context [PreludeSDK::Models::NotifySendParams::Context] Context for replying to an inbound message. When provided, the message is sent a
171
+ #
170
172
  # @param correlation_id [String] A user-defined identifier to correlate this message with your internal systems.
171
173
  #
172
- # @param document [PreludeSDK::Models::NotifySendParams::Document] A document to attach to the message. Only supported on WhatsApp templates that h
174
+ # @param document [PreludeSDK::Models::NotifySendParams::Document] A media attachment to include in the message header. Supported on
173
175
  #
174
176
  # @param expires_at [Time] The message expiration date in RFC3339 format. The message will not be sent if t
175
177
  #
@@ -181,6 +183,8 @@ module PreludeSDK
181
183
  #
182
184
  # @param schedule_at [Time] Schedule the message for future delivery in RFC3339 format. Marketing messages c
183
185
  #
186
+ # @param text [String] The reply message body. Required when `context.reply_to` is provided. Used for 2
187
+ #
184
188
  # @param variables [Hash{Symbol=>String}] The variables to be replaced in the template.
185
189
  #
186
190
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -214,7 +218,7 @@ module PreludeSDK
214
218
  #
215
219
  # @param correlation_id [String] A user-defined identifier to correlate this request with your internal systems.
216
220
  #
217
- # @param document [PreludeSDK::Models::NotifySendBatchParams::Document] A document to attach to the message. Only supported on WhatsApp templates that h
221
+ # @param document [PreludeSDK::Models::NotifySendBatchParams::Document] A media attachment to include in the message header. Supported on
218
222
  #
219
223
  # @param expires_at [Time] The message expiration date in RFC3339 format. Messages will not be sent after t
220
224
  #
@@ -22,7 +22,7 @@ module PreludeSDK
22
22
  #
23
23
  # @param correlation_id [String] A user-defined identifier to correlate this transactional message with. It is re
24
24
  #
25
- # @param document [PreludeSDK::Models::TransactionalSendParams::Document] A document to attach to the message. Only supported on WhatsApp templates that h
25
+ # @param document [PreludeSDK::Models::TransactionalSendParams::Document] A media attachment to include in the message header. Supported on
26
26
  #
27
27
  # @param expires_at [String] The message expiration date.
28
28
  #
@@ -35,12 +35,15 @@ module PreludeSDK
35
35
  )
36
36
  end
37
37
 
38
+ # Some parameter documentations has been truncated, see
39
+ # {PreludeSDK::Models::WatchSendEventsParams} for more details.
40
+ #
38
41
  # Send real-time event data from end-user interactions within your application.
39
42
  # Events will be analyzed for proactive fraud prevention and risk scoring.
40
43
  #
41
44
  # @overload send_events(events:, request_options: {})
42
45
  #
43
- # @param events [Array<PreludeSDK::Models::WatchSendEventsParams::Event>] A list of events to dispatch.
46
+ # @param events [Array<PreludeSDK::Models::WatchSendEventsParams::Event>] A list of events to dispatch. A maximum of 100 events can be sent in a single re
44
47
  #
45
48
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
46
49
  #
@@ -58,12 +61,15 @@ module PreludeSDK
58
61
  )
59
62
  end
60
63
 
64
+ # Some parameter documentations has been truncated, see
65
+ # {PreludeSDK::Models::WatchSendFeedbacksParams} for more details.
66
+ #
61
67
  # Send feedback regarding your end-users verification funnel. Events will be
62
68
  # analyzed for proactive fraud prevention and risk scoring.
63
69
  #
64
70
  # @overload send_feedbacks(feedbacks:, request_options: {})
65
71
  #
66
- # @param feedbacks [Array<PreludeSDK::Models::WatchSendFeedbacksParams::Feedback>] A list of feedbacks to send.
72
+ # @param feedbacks [Array<PreludeSDK::Models::WatchSendFeedbacksParams::Feedback>] A list of feedbacks to send. A maximum of 100 feedbacks can be sent in a single
67
73
  #
68
74
  # @param request_options [PreludeSDK::RequestOptions, Hash{Symbol=>Object}, nil]
69
75
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PreludeSDK
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -148,12 +148,20 @@ module PreludeSDK
148
148
  end
149
149
  end
150
150
 
151
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
152
+ RFC_3986_NOT_PCHARS = T.let(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/, Regexp)
153
+
151
154
  class << self
152
155
  # @api private
153
156
  sig { params(uri: URI::Generic).returns(String) }
154
157
  def uri_origin(uri)
155
158
  end
156
159
 
160
+ # @api private
161
+ sig { params(path: T.any(String, Integer)).returns(String) }
162
+ def encode_path(path)
163
+ end
164
+
157
165
  # @api private
158
166
  sig { params(path: T.any(String, T::Array[String])).returns(String) }
159
167
  def interpolate_path(path)
@@ -36,8 +36,16 @@ module PreludeSDK
36
36
  sig { params(correlation_id: String).void }
37
37
  attr_writer :correlation_id
38
38
 
39
- # A document to attach to the message. Only supported on WhatsApp templates that
40
- # have a document header.
39
+ # A media attachment to include in the message header. Supported on WhatsApp
40
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
41
+ # type is determined by the template's registered header format; send the matching
42
+ # file type for each.
43
+ #
44
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
45
+ # required and displayed to the recipient.
46
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
47
+ # is ignored.
48
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
41
49
  sig { returns(T.nilable(PreludeSDK::NotifySendBatchParams::Document)) }
42
50
  attr_reader :document
43
51
 
@@ -129,8 +137,16 @@ module PreludeSDK
129
137
  callback_url: nil,
130
138
  # A user-defined identifier to correlate this request with your internal systems.
131
139
  correlation_id: nil,
132
- # A document to attach to the message. Only supported on WhatsApp templates that
133
- # have a document header.
140
+ # A media attachment to include in the message header. Supported on WhatsApp
141
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
142
+ # type is determined by the template's registered header format; send the matching
143
+ # file type for each.
144
+ #
145
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
146
+ # required and displayed to the recipient.
147
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
148
+ # is ignored.
149
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
134
150
  document: nil,
135
151
  # The message expiration date in RFC3339 format. Messages will not be sent after
136
152
  # this time.
@@ -181,26 +197,43 @@ module PreludeSDK
181
197
  )
182
198
  end
183
199
 
184
- # The filename to display for the document.
185
- sig { returns(String) }
186
- attr_accessor :filename
187
-
188
- # The URL of the document to attach. Must be a valid HTTP or HTTPS URL.
200
+ # HTTPS URL of the media file. The file extension must match the template's
201
+ # registered header format (PDF for DOCUMENT; PNG/JPG/JPEG/WEBP for IMAGE; MP4/3GP
202
+ # for VIDEO).
189
203
  sig { returns(String) }
190
204
  attr_accessor :url
191
205
 
192
- # A document to attach to the message. Only supported on WhatsApp templates that
193
- # have a document header.
194
- sig { params(filename: String, url: String).returns(T.attached_class) }
206
+ # Filename displayed to the recipient. Required for templates with a `DOCUMENT`
207
+ # header; ignored for `IMAGE` and `VIDEO` headers.
208
+ sig { returns(T.nilable(String)) }
209
+ attr_reader :filename
210
+
211
+ sig { params(filename: String).void }
212
+ attr_writer :filename
213
+
214
+ # A media attachment to include in the message header. Supported on WhatsApp
215
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
216
+ # type is determined by the template's registered header format; send the matching
217
+ # file type for each.
218
+ #
219
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
220
+ # required and displayed to the recipient.
221
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
222
+ # is ignored.
223
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
224
+ sig { params(url: String, filename: String).returns(T.attached_class) }
195
225
  def self.new(
196
- # The filename to display for the document.
197
- filename:,
198
- # The URL of the document to attach. Must be a valid HTTP or HTTPS URL.
199
- url:
226
+ # HTTPS URL of the media file. The file extension must match the template's
227
+ # registered header format (PDF for DOCUMENT; PNG/JPG/JPEG/WEBP for IMAGE; MP4/3GP
228
+ # for VIDEO).
229
+ url:,
230
+ # Filename displayed to the recipient. Required for templates with a `DOCUMENT`
231
+ # header; ignored for `IMAGE` and `VIDEO` headers.
232
+ filename: nil
200
233
  )
201
234
  end
202
235
 
203
- sig { override.returns({ filename: String, url: String }) }
236
+ sig { override.returns({ url: String, filename: String }) }
204
237
  def to_hash
205
238
  end
206
239
  end
@@ -220,6 +253,11 @@ module PreludeSDK
220
253
  :sms,
221
254
  PreludeSDK::NotifySendBatchParams::PreferredChannel::TaggedSymbol
222
255
  )
256
+ RCS =
257
+ T.let(
258
+ :rcs,
259
+ PreludeSDK::NotifySendBatchParams::PreferredChannel::TaggedSymbol
260
+ )
223
261
  WHATSAPP =
224
262
  T.let(
225
263
  :whatsapp,
@@ -26,6 +26,16 @@ module PreludeSDK
26
26
  sig { params(callback_url: String).void }
27
27
  attr_writer :callback_url
28
28
 
29
+ # Context for replying to an inbound message. When provided, the message is sent
30
+ # as a WhatsApp reply within the 24-hour conversation window.
31
+ sig { returns(T.nilable(PreludeSDK::NotifySendParams::Context)) }
32
+ attr_reader :context
33
+
34
+ sig do
35
+ params(context: PreludeSDK::NotifySendParams::Context::OrHash).void
36
+ end
37
+ attr_writer :context
38
+
29
39
  # A user-defined identifier to correlate this message with your internal systems.
30
40
  # It is returned in the response and any webhook events that refer to this
31
41
  # message.
@@ -35,8 +45,16 @@ module PreludeSDK
35
45
  sig { params(correlation_id: String).void }
36
46
  attr_writer :correlation_id
37
47
 
38
- # A document to attach to the message. Only supported on WhatsApp templates that
39
- # have a document header.
48
+ # A media attachment to include in the message header. Supported on WhatsApp
49
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
50
+ # type is determined by the template's registered header format; send the matching
51
+ # file type for each.
52
+ #
53
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
54
+ # required and displayed to the recipient.
55
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
56
+ # is ignored.
57
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
40
58
  sig { returns(T.nilable(PreludeSDK::NotifySendParams::Document)) }
41
59
  attr_reader :document
42
60
 
@@ -96,6 +114,15 @@ module PreludeSDK
96
114
  sig { params(schedule_at: Time).void }
97
115
  attr_writer :schedule_at
98
116
 
117
+ # The reply message body. Required when `context.reply_to` is provided. Used for
118
+ # 2-way WhatsApp messaging to send free-form text replies within a conversation
119
+ # window.
120
+ sig { returns(T.nilable(String)) }
121
+ attr_reader :text
122
+
123
+ sig { params(text: String).void }
124
+ attr_writer :text
125
+
99
126
  # The variables to be replaced in the template.
100
127
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
101
128
  attr_reader :variables
@@ -108,6 +135,7 @@ module PreludeSDK
108
135
  template_id: String,
109
136
  to: String,
110
137
  callback_url: String,
138
+ context: PreludeSDK::NotifySendParams::Context::OrHash,
111
139
  correlation_id: String,
112
140
  document: PreludeSDK::NotifySendParams::Document::OrHash,
113
141
  expires_at: Time,
@@ -116,6 +144,7 @@ module PreludeSDK
116
144
  preferred_channel:
117
145
  PreludeSDK::NotifySendParams::PreferredChannel::OrSymbol,
118
146
  schedule_at: Time,
147
+ text: String,
119
148
  variables: T::Hash[Symbol, String],
120
149
  request_options: PreludeSDK::RequestOptions::OrHash
121
150
  ).returns(T.attached_class)
@@ -127,12 +156,23 @@ module PreludeSDK
127
156
  to:,
128
157
  # The URL where webhooks will be sent for message delivery events.
129
158
  callback_url: nil,
159
+ # Context for replying to an inbound message. When provided, the message is sent
160
+ # as a WhatsApp reply within the 24-hour conversation window.
161
+ context: nil,
130
162
  # A user-defined identifier to correlate this message with your internal systems.
131
163
  # It is returned in the response and any webhook events that refer to this
132
164
  # message.
133
165
  correlation_id: nil,
134
- # A document to attach to the message. Only supported on WhatsApp templates that
135
- # have a document header.
166
+ # A media attachment to include in the message header. Supported on WhatsApp
167
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
168
+ # type is determined by the template's registered header format; send the matching
169
+ # file type for each.
170
+ #
171
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
172
+ # required and displayed to the recipient.
173
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
174
+ # is ignored.
175
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
136
176
  document: nil,
137
177
  # The message expiration date in RFC3339 format. The message will not be sent if
138
178
  # this time is reached.
@@ -151,6 +191,10 @@ module PreludeSDK
151
191
  # can be scheduled up to 90 days in advance and will be automatically adjusted for
152
192
  # compliance with local time window restrictions.
153
193
  schedule_at: nil,
194
+ # The reply message body. Required when `context.reply_to` is provided. Used for
195
+ # 2-way WhatsApp messaging to send free-form text replies within a conversation
196
+ # window.
197
+ text: nil,
154
198
  # The variables to be replaced in the template.
155
199
  variables: nil,
156
200
  request_options: {}
@@ -163,6 +207,7 @@ module PreludeSDK
163
207
  template_id: String,
164
208
  to: String,
165
209
  callback_url: String,
210
+ context: PreludeSDK::NotifySendParams::Context,
166
211
  correlation_id: String,
167
212
  document: PreludeSDK::NotifySendParams::Document,
168
213
  expires_at: Time,
@@ -171,6 +216,7 @@ module PreludeSDK
171
216
  preferred_channel:
172
217
  PreludeSDK::NotifySendParams::PreferredChannel::OrSymbol,
173
218
  schedule_at: Time,
219
+ text: String,
174
220
  variables: T::Hash[Symbol, String],
175
221
  request_options: PreludeSDK::RequestOptions
176
222
  }
@@ -179,35 +225,81 @@ module PreludeSDK
179
225
  def to_hash
180
226
  end
181
227
 
182
- class Document < PreludeSDK::Internal::Type::BaseModel
228
+ class Context < PreludeSDK::Internal::Type::BaseModel
183
229
  OrHash =
184
230
  T.type_alias do
185
231
  T.any(
186
- PreludeSDK::NotifySendParams::Document,
232
+ PreludeSDK::NotifySendParams::Context,
187
233
  PreludeSDK::Internal::AnyHash
188
234
  )
189
235
  end
190
236
 
191
- # The filename to display for the document.
237
+ # The inbound message ID (prefixed with `im_`) to reply to. This ID is provided in
238
+ # the `inbound.message.received` webhook event.
192
239
  sig { returns(String) }
193
- attr_accessor :filename
240
+ attr_accessor :reply_to
194
241
 
195
- # The URL of the document to attach. Must be a valid HTTP or HTTPS URL.
242
+ # Context for replying to an inbound message. When provided, the message is sent
243
+ # as a WhatsApp reply within the 24-hour conversation window.
244
+ sig { params(reply_to: String).returns(T.attached_class) }
245
+ def self.new(
246
+ # The inbound message ID (prefixed with `im_`) to reply to. This ID is provided in
247
+ # the `inbound.message.received` webhook event.
248
+ reply_to:
249
+ )
250
+ end
251
+
252
+ sig { override.returns({ reply_to: String }) }
253
+ def to_hash
254
+ end
255
+ end
256
+
257
+ class Document < PreludeSDK::Internal::Type::BaseModel
258
+ OrHash =
259
+ T.type_alias do
260
+ T.any(
261
+ PreludeSDK::NotifySendParams::Document,
262
+ PreludeSDK::Internal::AnyHash
263
+ )
264
+ end
265
+
266
+ # HTTPS URL of the media file. The file extension must match the template's
267
+ # registered header format (PDF for DOCUMENT; PNG/JPG/JPEG/WEBP for IMAGE; MP4/3GP
268
+ # for VIDEO).
196
269
  sig { returns(String) }
197
270
  attr_accessor :url
198
271
 
199
- # A document to attach to the message. Only supported on WhatsApp templates that
200
- # have a document header.
201
- sig { params(filename: String, url: String).returns(T.attached_class) }
272
+ # Filename displayed to the recipient. Required for templates with a `DOCUMENT`
273
+ # header; ignored for `IMAGE` and `VIDEO` headers.
274
+ sig { returns(T.nilable(String)) }
275
+ attr_reader :filename
276
+
277
+ sig { params(filename: String).void }
278
+ attr_writer :filename
279
+
280
+ # A media attachment to include in the message header. Supported on WhatsApp
281
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
282
+ # type is determined by the template's registered header format; send the matching
283
+ # file type for each.
284
+ #
285
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
286
+ # required and displayed to the recipient.
287
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
288
+ # is ignored.
289
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
290
+ sig { params(url: String, filename: String).returns(T.attached_class) }
202
291
  def self.new(
203
- # The filename to display for the document.
204
- filename:,
205
- # The URL of the document to attach. Must be a valid HTTP or HTTPS URL.
206
- url:
292
+ # HTTPS URL of the media file. The file extension must match the template's
293
+ # registered header format (PDF for DOCUMENT; PNG/JPG/JPEG/WEBP for IMAGE; MP4/3GP
294
+ # for VIDEO).
295
+ url:,
296
+ # Filename displayed to the recipient. Required for templates with a `DOCUMENT`
297
+ # header; ignored for `IMAGE` and `VIDEO` headers.
298
+ filename: nil
207
299
  )
208
300
  end
209
301
 
210
- sig { override.returns({ filename: String, url: String }) }
302
+ sig { override.returns({ url: String, filename: String }) }
211
303
  def to_hash
212
304
  end
213
305
  end
@@ -228,6 +320,11 @@ module PreludeSDK
228
320
  :sms,
229
321
  PreludeSDK::NotifySendParams::PreferredChannel::TaggedSymbol
230
322
  )
323
+ RCS =
324
+ T.let(
325
+ :rcs,
326
+ PreludeSDK::NotifySendParams::PreferredChannel::TaggedSymbol
327
+ )
231
328
  WHATSAPP =
232
329
  T.let(
233
330
  :whatsapp,
@@ -38,8 +38,16 @@ module PreludeSDK
38
38
  sig { params(correlation_id: String).void }
39
39
  attr_writer :correlation_id
40
40
 
41
- # A document to attach to the message. Only supported on WhatsApp templates that
42
- # have a document header.
41
+ # A media attachment to include in the message header. Supported on WhatsApp
42
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
43
+ # type is determined by the template's registered header format; send the matching
44
+ # file type for each.
45
+ #
46
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
47
+ # required and displayed to the recipient.
48
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
49
+ # is ignored.
50
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
43
51
  sig { returns(T.nilable(PreludeSDK::TransactionalSendParams::Document)) }
44
52
  attr_reader :document
45
53
 
@@ -134,8 +142,16 @@ module PreludeSDK
134
142
  # returned in the response and any webhook events that refer to this
135
143
  # transactionalmessage.
136
144
  correlation_id: nil,
137
- # A document to attach to the message. Only supported on WhatsApp templates that
138
- # have a document header.
145
+ # A media attachment to include in the message header. Supported on WhatsApp
146
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
147
+ # type is determined by the template's registered header format; send the matching
148
+ # file type for each.
149
+ #
150
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
151
+ # required and displayed to the recipient.
152
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
153
+ # is ignored.
154
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
139
155
  document: nil,
140
156
  # The message expiration date.
141
157
  expires_at: nil,
@@ -192,26 +208,43 @@ module PreludeSDK
192
208
  )
193
209
  end
194
210
 
195
- # The filename to display for the document.
196
- sig { returns(String) }
197
- attr_accessor :filename
198
-
199
- # The URL of the document to attach. Must be a valid HTTP or HTTPS URL.
211
+ # HTTPS URL of the media file. The file extension must match the template's
212
+ # registered header format (PDF for DOCUMENT; PNG/JPG/JPEG/WEBP for IMAGE; MP4/3GP
213
+ # for VIDEO).
200
214
  sig { returns(String) }
201
215
  attr_accessor :url
202
216
 
203
- # A document to attach to the message. Only supported on WhatsApp templates that
204
- # have a document header.
205
- sig { params(filename: String, url: String).returns(T.attached_class) }
217
+ # Filename displayed to the recipient. Required for templates with a `DOCUMENT`
218
+ # header; ignored for `IMAGE` and `VIDEO` headers.
219
+ sig { returns(T.nilable(String)) }
220
+ attr_reader :filename
221
+
222
+ sig { params(filename: String).void }
223
+ attr_writer :filename
224
+
225
+ # A media attachment to include in the message header. Supported on WhatsApp
226
+ # templates registered with a `DOCUMENT`, `IMAGE`, or `VIDEO` header. The media
227
+ # type is determined by the template's registered header format; send the matching
228
+ # file type for each.
229
+ #
230
+ # - `DOCUMENT` headers accept PDF and other document formats; `filename` is
231
+ # required and displayed to the recipient.
232
+ # - `IMAGE` headers accept `.png`, `.jpg`, `.jpeg`, and `.webp` URLs; `filename`
233
+ # is ignored.
234
+ # - `VIDEO` headers accept `.mp4` and `.3gp` URLs; `filename` is ignored.
235
+ sig { params(url: String, filename: String).returns(T.attached_class) }
206
236
  def self.new(
207
- # The filename to display for the document.
208
- filename:,
209
- # The URL of the document to attach. Must be a valid HTTP or HTTPS URL.
210
- url:
237
+ # HTTPS URL of the media file. The file extension must match the template's
238
+ # registered header format (PDF for DOCUMENT; PNG/JPG/JPEG/WEBP for IMAGE; MP4/3GP
239
+ # for VIDEO).
240
+ url:,
241
+ # Filename displayed to the recipient. Required for templates with a `DOCUMENT`
242
+ # header; ignored for `IMAGE` and `VIDEO` headers.
243
+ filename: nil
211
244
  )
212
245
  end
213
246
 
214
- sig { override.returns({ filename: String, url: String }) }
247
+ sig { override.returns({ url: String, filename: String }) }
215
248
  def to_hash
216
249
  end
217
250
  end