telerivet 1.8.5 → 1.9.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa70ed97588b66c3d7fd0d24005b2403babaadec99e991282932c2affb0235dc
4
- data.tar.gz: 8ba55152dbe5c5a4fe721de7c1eb4736d0c11ae67085f15c8a45d44489553184
3
+ metadata.gz: 34e9871ede25de1cdf8bfe1c005fe4e8e60379bdc69248ad5970c12f50c38e0c
4
+ data.tar.gz: 61ad68fa5fb5b4330007e22771b48246bf77b21896b63fde13f3ee78d7a3fc34
5
5
  SHA512:
6
- metadata.gz: ffeac3152f1a8138fd00a43887c17a67a694472f4b66631735f6c71d106d55c56280cf0170b944700ede23c4b4c84718b1eaf92e1ddec92c3922355cc5322112
7
- data.tar.gz: 433530a39c90af7ac38e49f093e3a77e91c11777987b4bc0de1b8fd4b013bb798e1d02d8a2a3332a3fc87b34c048680090714f6b2a90ba63bfd440f0ed4d9918
6
+ metadata.gz: 32711fe64279b39a08a3de779cfa390e2e2089259f79a486b6cddf81e6d7d659a1767c7362753aac38bd68f18077e4f1bf13b6f24a6c308805189787d17bc0e3
7
+ data.tar.gz: 4ed7248b9c7a3ee4e47daae81ee614ce249f52701c872227723b892a89c740a814f4daf1c0f403e55ad8280430b2f0cf644c951d31d4f1cb192d128d2ecb1407
@@ -2,7 +2,8 @@
2
2
  module Telerivet
3
3
 
4
4
  #
5
- # Represents a transaction where airtime is sent to a mobile phone number.
5
+ # Represents a transaction where airtime is sent to a mobile phone number. This also is used
6
+ # to represent non-airtime value transfers such as data bundles or gift cards.
6
7
  #
7
8
  # To send airtime, first [create a Custom Actions service to send a particular amount of
8
9
  # airtime](/dashboard/add_service?subtype_id=main.service.rules.contact&action_id=main.rule.sendairtime),
@@ -115,7 +115,8 @@ module Telerivet
115
115
  #
116
116
  # - source
117
117
  # * How the message originated within Telerivet
118
- # * Allowed values: phone, provider, web, api, service, webhook, scheduled, integration
118
+ # * Allowed values: phone, provider, web, api, service, webhook, scheduled, integration,
119
+ # mcp
119
120
  # * Read-only
120
121
  #
121
122
  # - simulated (bool)
@@ -139,11 +140,8 @@ module Telerivet
139
140
  # * Read-only
140
141
  #
141
142
  # - media (array)
142
- # * For text messages containing media files, this is an array of objects with the
143
- # properties `url`, `type` (MIME type), `filename`, and `size` (file size in bytes).
144
- # Unknown properties are null. This property is undefined for messages that do not
145
- # contain media files. Note: For files uploaded via the Telerivet web app, the URL is
146
- # temporary and may not be valid for more than 1 day.
143
+ # * Array of media attachments for the text message. This property is undefined for
144
+ # messages that do not contain media files.
147
145
  # * Read-only
148
146
  #
149
147
  # - vars (Hash)
@@ -192,6 +190,10 @@ module Telerivet
192
190
  # call flow)
193
191
  # * Read-only
194
192
  #
193
+ # - url
194
+ # * URL to this broadcast in the Telerivet web app
195
+ # * Read-only
196
+ #
195
197
  # - user_id (string, max 34 characters)
196
198
  # * ID of the Telerivet user who sent the broadcast (if applicable)
197
199
  # * Read-only
@@ -345,6 +347,10 @@ class Broadcast < Entity
345
347
  get('service_id')
346
348
  end
347
349
 
350
+ def url
351
+ get('url')
352
+ end
353
+
348
354
  def user_id
349
355
  get('user_id')
350
356
  end
@@ -0,0 +1,481 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # A campaign is something that is sent to a group of contacts on a particular schedule.
6
+ #
7
+ # Depending on the campaign type, a campaign may send a text message, make a
8
+ # voice call, or trigger an automated service. A campaign may either send a single broadcast
9
+ # at once, or send multiple broadcasts to different contacts over time.
10
+ #
11
+ # Campaigns are initially created as a draft and can be edited and previewed
12
+ # before being sent. This supports a workflow where campaigns can be drafted via the API, and
13
+ # subsequently edited, approved, and sent via either the web app or the API. Once sent, a
14
+ # campaign creates one or more broadcasts to deliver messages to the target recipients.
15
+ #
16
+ # Campaigns build on top of other core entity types including broadcasts and
17
+ # scheduled messages. Although it is possible to send broadcasts or schedule messages directly
18
+ # via the API, campaigns can be used in order to provide the ability to save drafts, allow
19
+ # manual editing and approval before sending, or to organize broadcasts within Telerivet.
20
+ #
21
+ # Fields:
22
+ #
23
+ # - id (string, max 34 characters)
24
+ # * ID of the campaign
25
+ # * Read-only
26
+ #
27
+ # - name
28
+ # * Name of the campaign, which must be unique within the project. The campaign name is
29
+ # only visible within Telerivet, and does not appear in the messages sent to contacts.
30
+ # * Updatable via API
31
+ #
32
+ # - campaign_type
33
+ # * Type of the campaign. The following campaign types are available:
34
+ #
35
+ # - `broadcast_text` - Send a text message to a group of contacts
36
+ # - `broadcast_call` - Send a voice call to a group of contacts
37
+ # - `broadcast_svc` - Trigger a service for a group of contacts
38
+ # - `relative` - Send a series of messages over time relative to
39
+ # when each contact was added to a group
40
+ # - `anniversary` - Send messages on recurring dates (e.g.
41
+ # birthdays, anniversaries)
42
+ # * Allowed values: broadcast_text, broadcast_call, broadcast_svc, relative, anniversary
43
+ # * Read-only
44
+ #
45
+ # - status
46
+ # * Current status of the campaign
47
+ # * Allowed values: draft, scheduled, sent, pending_review
48
+ # * Read-only
49
+ #
50
+ # - group_id
51
+ # * ID of the group of contacts that the campaign will be sent to
52
+ # * Updatable via API
53
+ #
54
+ # - exclude_group_id
55
+ # * ID of a group of contacts to exclude from the campaign
56
+ # * Updatable via API
57
+ #
58
+ # - route_id
59
+ # * ID of the phone or route used to send the campaign
60
+ # * Updatable via API
61
+ #
62
+ # - broadcast_id
63
+ # * ID of the most recent broadcast created by this campaign, if applicable
64
+ # * Read-only
65
+ #
66
+ # - estimated_count (int)
67
+ # * Estimated number of messages that will be sent in this campaign
68
+ # * Read-only
69
+ #
70
+ # - message_count (int)
71
+ # * Number of messages that have been sent in this campaign
72
+ # * Read-only
73
+ #
74
+ # - respondent_group_id
75
+ # * ID of a group to add contacts to after they respond to the campaign
76
+ # * Updatable via API
77
+ #
78
+ # - clicked_group_id
79
+ # * ID of a group to add contacts to after they click a link in the campaign
80
+ # * Updatable via API
81
+ #
82
+ # - label_ids (array)
83
+ # * List of IDs of labels applied to messages sent by this campaign
84
+ # * Updatable via API
85
+ #
86
+ # - schedule_mode
87
+ # * Indicates whether the campaign should be sent immediately or at a future time
88
+ # (applies to broadcast campaign types). If `schedule_time` is set, `schedule_mode` is
89
+ # automatically set to `at_time`. If `schedule_mode` is set to `immediate` or `null`,
90
+ # `schedule_time` is automatically cleared.
91
+ #
92
+ # Note that after setting schedule_mode to "immediate" on a campaign
93
+ # with the `draft` status, the campaign will not actually be sent until the API method
94
+ # is called to [send the campaign](#Campaign.send).
95
+ # * Allowed values: immediate, at_time
96
+ # * Updatable via API
97
+ #
98
+ # - schedule_time (UNIX timestamp)
99
+ # * The time to send the campaign, as a UNIX timestamp (applies to broadcast campaign
100
+ # types). Setting this to a non-null value automatically sets `schedule_mode` to
101
+ # `at_time`.
102
+ #
103
+ # Note that after setting schedule_time on a campaign with the
104
+ # `draft` status, the campaign will not actually be scheduled until the API method is
105
+ # called to [schedule the campaign](#Campaign.send).
106
+ # * Updatable via API
107
+ #
108
+ # - content (string)
109
+ # * Text content of the message (applies to `broadcast_text` campaigns), or the
110
+ # text-to-speech text for voice calls (applies to `broadcast_call` campaigns). May
111
+ # contain variables like `[[contact.name]]`.
112
+ #
113
+ # [(See available variables)](#variables)
114
+ # * Updatable via API
115
+ #
116
+ # - media (array)
117
+ # * Array of media attachments (applies to `broadcast_text` campaigns).
118
+ # * Read-only
119
+ #
120
+ # - route_params (Hash)
121
+ # * Route-specific parameters for the message (applies to `broadcast_text` campaigns).
122
+ # See [Route-Specific Parameters](#route_params).
123
+ # * Updatable via API
124
+ #
125
+ # - track_clicks (boolean)
126
+ # * Whether to shorten links and track link clicks (applies to `broadcast_text`
127
+ # campaigns).
128
+ # * Updatable via API
129
+ #
130
+ # - short_link_params (Hash)
131
+ # * Parameters for short links when `track_clicks` is enabled (applies to
132
+ # `broadcast_text` campaigns).
133
+ # * Updatable via API
134
+ #
135
+ # - audio_url
136
+ # * For voice calls, the URL of an MP3 file to play when the contact answers the call
137
+ # (applies to `broadcast_call` campaigns)
138
+ # * Updatable via API
139
+ #
140
+ # - tts_lang
141
+ # * For voice calls, the language of the text-to-speech voice (applies to
142
+ # `broadcast_call` campaigns)
143
+ # * Allowed values: en-US, en-GB, en-GB-WLS, en-AU, en-IN, da-DK, nl-NL, fr-FR, fr-CA,
144
+ # de-DE, is-IS, it-IT, pl-PL, pt-BR, pt-PT, ru-RU, es-ES, es-US, sv-SE
145
+ # * Updatable via API
146
+ #
147
+ # - tts_voice
148
+ # * For voice calls, the text-to-speech voice (applies to `broadcast_call` campaigns)
149
+ # * Allowed values: female, male
150
+ # * Updatable via API
151
+ #
152
+ # - service_id
153
+ # * ID of the service associated with this campaign (applies to `broadcast_call` or
154
+ # `broadcast_svc` campaigns)
155
+ # * Read-only
156
+ #
157
+ # - date_variable
158
+ # * Custom contact variable storing date or date/time values relative to which messages
159
+ # will be scheduled (applies to `relative` and `anniversary` campaigns)
160
+ # * Updatable via API
161
+ #
162
+ # - items (array)
163
+ # * Array of campaign items (applies to `relative` and `anniversary` campaigns). Each
164
+ # item defines a scheduled message with timing and content.
165
+ # * Updatable via API
166
+ #
167
+ # - message_type
168
+ # * Type of messages sent by this campaign, or null if not applicable
169
+ # * Read-only
170
+ #
171
+ # - timezone_id
172
+ # * The ID of the timezone used for scheduling messages in this campaign, or null to use
173
+ # the project's default timezone
174
+ # * Updatable via API
175
+ #
176
+ # - time_created (UNIX timestamp)
177
+ # * Time the campaign was created in Telerivet
178
+ # * Read-only
179
+ #
180
+ # - time_updated (UNIX timestamp)
181
+ # * Time the campaign was last updated in Telerivet
182
+ # * Read-only
183
+ #
184
+ # - vars (Hash)
185
+ # * Custom variables stored for this campaign. Variable names may be up to 32 characters
186
+ # in length and can contain the characters a-z, A-Z, 0-9, and _.
187
+ # Values may be strings, numbers, or boolean (true/false).
188
+ # String values may be up to 4096 bytes in length when encoded as UTF-8.
189
+ # Up to 100 variables are supported per object.
190
+ # Setting a variable to null will delete the variable.
191
+ # * Updatable via API
192
+ #
193
+ # - url
194
+ # * URL to view the campaign in the Telerivet web app
195
+ # * Read-only
196
+ #
197
+ # - url_edit
198
+ # * URL to edit the campaign in the Telerivet web app
199
+ # * Read-only
200
+ #
201
+ # - url_send
202
+ # * URL to preview and send the campaign in the Telerivet web app
203
+ # * Read-only
204
+ #
205
+ # - user_id
206
+ # * ID of the Telerivet user who created the campaign
207
+ # * Read-only
208
+ #
209
+ # - project_id
210
+ # * ID of the project this campaign belongs to
211
+ # * Read-only
212
+ #
213
+ class Campaign < Entity
214
+ #
215
+ # Saves any fields or custom variables that have changed for this campaign.
216
+ #
217
+ def save()
218
+ super
219
+ end
220
+
221
+ #
222
+ # Sends or schedules this campaign. The campaign must be in the `draft` or `scheduled` status,
223
+ # and must be fully configured (e.g. with a group, route, and message content).
224
+ #
225
+ # For broadcast campaigns, this will send the campaign immediately if
226
+ # the campaign's `schedule_mode` is `immediate`. If `schedule_mode` is `at_time`, it will
227
+ # schedule the campaign to be sent at the time of the `schedule_time` timestamp.
228
+ #
229
+ # For relative and anniversary campaigns, this will schedule the
230
+ # campaign according to the configuration in the `items` and `date_variable` properties.
231
+ #
232
+ # Returns:
233
+ # Telerivet::Campaign
234
+ #
235
+ def send()
236
+ require_relative 'campaign'
237
+ Campaign.new(@api, @api.do_request("POST", get_base_api_path() + "/send"))
238
+ end
239
+
240
+ #
241
+ # Cancels a scheduled campaign, reverting it to the `draft` status. The campaign must be in
242
+ # the `scheduled` or `pending_review` status.
243
+ #
244
+ # Returns:
245
+ # Telerivet::Campaign
246
+ #
247
+ def unschedule()
248
+ require_relative 'campaign'
249
+ Campaign.new(@api, @api.do_request("POST", get_base_api_path() + "/unschedule"))
250
+ end
251
+
252
+ #
253
+ # Deletes this campaign. Any scheduled messages will be cancelled.
254
+ #
255
+ def delete()
256
+ @api.do_request("DELETE", get_base_api_path())
257
+ end
258
+
259
+ def id
260
+ get('id')
261
+ end
262
+
263
+ def name
264
+ get('name')
265
+ end
266
+
267
+ def name=(value)
268
+ set('name', value)
269
+ end
270
+
271
+ def campaign_type
272
+ get('campaign_type')
273
+ end
274
+
275
+ def status
276
+ get('status')
277
+ end
278
+
279
+ def group_id
280
+ get('group_id')
281
+ end
282
+
283
+ def group_id=(value)
284
+ set('group_id', value)
285
+ end
286
+
287
+ def exclude_group_id
288
+ get('exclude_group_id')
289
+ end
290
+
291
+ def exclude_group_id=(value)
292
+ set('exclude_group_id', value)
293
+ end
294
+
295
+ def route_id
296
+ get('route_id')
297
+ end
298
+
299
+ def route_id=(value)
300
+ set('route_id', value)
301
+ end
302
+
303
+ def broadcast_id
304
+ get('broadcast_id')
305
+ end
306
+
307
+ def estimated_count
308
+ get('estimated_count')
309
+ end
310
+
311
+ def message_count
312
+ get('message_count')
313
+ end
314
+
315
+ def respondent_group_id
316
+ get('respondent_group_id')
317
+ end
318
+
319
+ def respondent_group_id=(value)
320
+ set('respondent_group_id', value)
321
+ end
322
+
323
+ def clicked_group_id
324
+ get('clicked_group_id')
325
+ end
326
+
327
+ def clicked_group_id=(value)
328
+ set('clicked_group_id', value)
329
+ end
330
+
331
+ def label_ids
332
+ get('label_ids')
333
+ end
334
+
335
+ def label_ids=(value)
336
+ set('label_ids', value)
337
+ end
338
+
339
+ def schedule_mode
340
+ get('schedule_mode')
341
+ end
342
+
343
+ def schedule_mode=(value)
344
+ set('schedule_mode', value)
345
+ end
346
+
347
+ def schedule_time
348
+ get('schedule_time')
349
+ end
350
+
351
+ def schedule_time=(value)
352
+ set('schedule_time', value)
353
+ end
354
+
355
+ def content
356
+ get('content')
357
+ end
358
+
359
+ def content=(value)
360
+ set('content', value)
361
+ end
362
+
363
+ def media
364
+ get('media')
365
+ end
366
+
367
+ def route_params
368
+ get('route_params')
369
+ end
370
+
371
+ def route_params=(value)
372
+ set('route_params', value)
373
+ end
374
+
375
+ def track_clicks
376
+ get('track_clicks')
377
+ end
378
+
379
+ def track_clicks=(value)
380
+ set('track_clicks', value)
381
+ end
382
+
383
+ def short_link_params
384
+ get('short_link_params')
385
+ end
386
+
387
+ def short_link_params=(value)
388
+ set('short_link_params', value)
389
+ end
390
+
391
+ def audio_url
392
+ get('audio_url')
393
+ end
394
+
395
+ def audio_url=(value)
396
+ set('audio_url', value)
397
+ end
398
+
399
+ def tts_lang
400
+ get('tts_lang')
401
+ end
402
+
403
+ def tts_lang=(value)
404
+ set('tts_lang', value)
405
+ end
406
+
407
+ def tts_voice
408
+ get('tts_voice')
409
+ end
410
+
411
+ def tts_voice=(value)
412
+ set('tts_voice', value)
413
+ end
414
+
415
+ def service_id
416
+ get('service_id')
417
+ end
418
+
419
+ def date_variable
420
+ get('date_variable')
421
+ end
422
+
423
+ def date_variable=(value)
424
+ set('date_variable', value)
425
+ end
426
+
427
+ def items
428
+ get('items')
429
+ end
430
+
431
+ def items=(value)
432
+ set('items', value)
433
+ end
434
+
435
+ def message_type
436
+ get('message_type')
437
+ end
438
+
439
+ def timezone_id
440
+ get('timezone_id')
441
+ end
442
+
443
+ def timezone_id=(value)
444
+ set('timezone_id', value)
445
+ end
446
+
447
+ def time_created
448
+ get('time_created')
449
+ end
450
+
451
+ def time_updated
452
+ get('time_updated')
453
+ end
454
+
455
+ def url
456
+ get('url')
457
+ end
458
+
459
+ def url_edit
460
+ get('url_edit')
461
+ end
462
+
463
+ def url_send
464
+ get('url_send')
465
+ end
466
+
467
+ def user_id
468
+ get('user_id')
469
+ end
470
+
471
+ def project_id
472
+ get('project_id')
473
+ end
474
+
475
+ def get_base_api_path()
476
+ "/projects/#{get('project_id')}/campaigns/#{get('id')}"
477
+ end
478
+
479
+ end
480
+
481
+ end
@@ -1,6 +1,17 @@
1
1
  module Telerivet
2
2
 
3
3
  #
4
+ # A contact represents a person or other entity that can be communicated with via phone number
5
+ # or other messaging channel within a project.
6
+ #
7
+ # Each contact has a name, phone number, and custom variables that can be used
8
+ # to personalize messages. Contacts can belong to one or more groups, and can be used as
9
+ # recipients for broadcasts, campaigns, and other messaging operations.
10
+ #
11
+ # Contacts can be imported or created individually via the API or web app. If
12
+ # the project's auto_create_contacts setting is enabled, a contact will be automatically
13
+ # created for each unique phone number that a message is sent to or received from.
14
+ #
4
15
  # Fields:
5
16
  #
6
17
  # - id (string, max 34 characters)
@@ -83,6 +94,10 @@ module Telerivet
83
94
  # - project_id
84
95
  # * ID of the project this contact belongs to
85
96
  # * Read-only
97
+ #
98
+ # - url
99
+ # * URL to this contact in the Telerivet web app
100
+ # * Read-only
86
101
  #
87
102
  class Contact < Entity
88
103
 
@@ -144,7 +159,7 @@ class Contact < Entity
144
159
  # - source
145
160
  # * Filter messages by source
146
161
  # * Allowed values: phone, provider, web, api, service, webhook, scheduled,
147
- # integration
162
+ # integration, mcp
148
163
  #
149
164
  # - starred (bool)
150
165
  # * Filter messages by starred/unstarred
@@ -478,6 +493,10 @@ class Contact < Entity
478
493
  get('project_id')
479
494
  end
480
495
 
496
+ def url
497
+ get('url')
498
+ end
499
+
481
500
  def get_base_api_path()
482
501
  "/projects/#{get('project_id')}/contacts/#{get('id')}"
483
502
  end
@@ -40,8 +40,10 @@ module Telerivet
40
40
  # * Read-only
41
41
  #
42
42
  # - vars (Hash)
43
- # * Custom variables stored for this contact/service state. Variable names may be up to
44
- # 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _.
43
+ # * Custom variables stored for this contact/service state. Only persisted when the
44
+ # state 'id' is non-null; saving with a null 'id' deletes the state and its variables.
45
+ # Variable names may be up to 32 characters in length and can contain the characters
46
+ # a-z, A-Z, 0-9, and _.
45
47
  # Values may be strings, numbers, or boolean (true/false).
46
48
  # String values may be up to 4096 bytes in length when encoded as UTF-8.
47
49
  # Up to 100 variables are supported per object.