telerivet 1.6.1 → 1.8.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.
@@ -0,0 +1,369 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # A relative scheduled message is a message that is scheduled relative to a date stored as a
6
+ # custom field for each recipient contact.
7
+ # This allows scheduling messages on a different date for each contact, for
8
+ # example on their birthday, a certain number of days before an appointment, or a certain
9
+ # number of days after enrolling in a campaign.
10
+ #
11
+ # Telerivet will automatically create a [ScheduledMessage](#ScheduledMessage)
12
+ # for each contact matching a RelativeScheduledMessage.
13
+ #
14
+ # Any service that can be manually triggered for a contact (including polls)
15
+ # may also be scheduled via a relative scheduled message, whether or not the service actually
16
+ # sends a message.
17
+ #
18
+ # Fields:
19
+ #
20
+ # - id (string, max 34 characters)
21
+ # * ID of the relative scheduled message
22
+ # * Read-only
23
+ #
24
+ # - content
25
+ # * Text content of the relative scheduled message
26
+ # * Updatable via API
27
+ #
28
+ # - time_of_day
29
+ # * Time of day when scheduled messages will be sent in HH:MM format (with hours from 00
30
+ # to 23)
31
+ # * Updatable via API
32
+ #
33
+ # - date_variable
34
+ # * Custom contact variable storing date or date/time values relative to which messages
35
+ # will be scheduled.
36
+ # * Updatable via API
37
+ #
38
+ # - offset_scale
39
+ # * The type of interval (day/week/month/year) that will be used to adjust the scheduled
40
+ # date relative to the date stored in the contact's date_variable, when offset_count is
41
+ # non-zero (D=day, W=week, M=month, Y=year)
42
+ # * Allowed values: D, W, M, Y
43
+ # * Updatable via API
44
+ #
45
+ # - offset_count (int)
46
+ # * The number of days/weeks/months/years to adjust the date of the scheduled message
47
+ # relative relative to the date stored in the contact's date_variable. May be positive,
48
+ # negative, or zero.
49
+ # * Updatable via API
50
+ #
51
+ # - rrule
52
+ # * Recurrence rule for recurring scheduled messages, e.g. 'FREQ=MONTHLY' or
53
+ # 'FREQ=WEEKLY;INTERVAL=2'; see
54
+ # [RFC2445](https://tools.ietf.org/html/rfc2445#section-4.3.10).
55
+ # * Updatable via API
56
+ #
57
+ # - end_time (UNIX timestamp)
58
+ # * Time after which recurring messages will stop (not applicable to non-recurring
59
+ # scheduled messages)
60
+ # * Updatable via API
61
+ #
62
+ # - timezone_id
63
+ # * Timezone ID used to compute times for recurring messages; see [List of tz database
64
+ # time zones Wikipedia
65
+ # article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
66
+ # * Updatable via API
67
+ #
68
+ # - recipients_str
69
+ # * A string with a human readable description of the recipient
70
+ # * Read-only
71
+ #
72
+ # - group_id
73
+ # * ID of the group to send the message to (null if the recipient is an individual
74
+ # contact)
75
+ # * Updatable via API
76
+ #
77
+ # - contact_id
78
+ # * ID of the contact to send the message to (null if the recipient is a group)
79
+ # * Updatable via API
80
+ #
81
+ # - to_number
82
+ # * Phone number to send the message to (null if the recipient is a group)
83
+ # * Updatable via API
84
+ #
85
+ # - route_id
86
+ # * ID of the phone or route the message will be sent from
87
+ # * Updatable via API
88
+ #
89
+ # - service_id (string, max 34 characters)
90
+ # * The service associated with this message (for voice calls, the service defines the
91
+ # call flow)
92
+ # * Updatable via API
93
+ #
94
+ # - audio_url
95
+ # * For voice calls, the URL of an MP3 file to play when the contact answers the call
96
+ # * Updatable via API
97
+ #
98
+ # - tts_lang
99
+ # * For voice calls, the language of the text-to-speech voice
100
+ # * Allowed values: en-US, en-GB, en-GB-WLS, en-AU, en-IN, da-DK, nl-NL, fr-FR, fr-CA,
101
+ # de-DE, is-IS, it-IT, pl-PL, pt-BR, pt-PT, ru-RU, es-ES, es-US, sv-SE
102
+ # * Updatable via API
103
+ #
104
+ # - tts_voice
105
+ # * For voice calls, the text-to-speech voice
106
+ # * Allowed values: female, male
107
+ # * Updatable via API
108
+ #
109
+ # - message_type
110
+ # * Type of scheduled message
111
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
112
+ # * Read-only
113
+ #
114
+ # - time_created (UNIX timestamp)
115
+ # * Time the relative scheduled message was created in Telerivet
116
+ # * Read-only
117
+ #
118
+ # - replace_variables (bool)
119
+ # * Set to true if Telerivet will render variables like [[contact.name]] in the message
120
+ # content, false otherwise
121
+ # * Updatable via API
122
+ #
123
+ # - track_clicks (boolean)
124
+ # * If true, URLs in the message content will automatically be replaced with unique
125
+ # short URLs
126
+ # * Updatable via API
127
+ #
128
+ # - media (array)
129
+ # * For text messages containing media files, this is an array of objects with the
130
+ # properties `url`, `type` (MIME type), `filename`, and `size` (file size in bytes).
131
+ # Unknown properties are null. This property is undefined for messages that do not
132
+ # contain media files. Note: For files uploaded via the Telerivet web app, the URL is
133
+ # temporary and may not be valid for more than 1 day.
134
+ # * Read-only
135
+ #
136
+ # - route_params (Hash)
137
+ # * Route-specific parameters to use when sending the message.
138
+ #
139
+ # When sending messages via chat apps such as WhatsApp, the route_params
140
+ # parameter can be used to send messages with app-specific features such as quick
141
+ # replies and link buttons.
142
+ #
143
+ # For more details, see [Route-Specific Parameters](#route_params).
144
+ # * Updatable via API
145
+ #
146
+ # - vars (Hash)
147
+ # * Custom variables stored for this scheduled message (copied to each ScheduledMessage
148
+ # and Message when sent). Variable names may be up to 32 characters in length and can
149
+ # contain the characters a-z, A-Z, 0-9, and _.
150
+ # Values may be strings, numbers, or boolean (true/false).
151
+ # String values may be up to 4096 bytes in length when encoded as UTF-8.
152
+ # Up to 100 variables are supported per object.
153
+ # Setting a variable to null will delete the variable.
154
+ # * Updatable via API
155
+ #
156
+ # - label_ids (array)
157
+ # * IDs of labels to add to the Message
158
+ # * Updatable via API
159
+ #
160
+ # - project_id
161
+ # * ID of the project this relative scheduled message belongs to
162
+ # * Read-only
163
+ #
164
+ class RelativeScheduledMessage < Entity
165
+ #
166
+ # Saves any fields or custom variables that have changed for this relative scheduled message.
167
+ #
168
+ def save()
169
+ super
170
+ end
171
+
172
+ #
173
+ # Deletes this relative scheduled message and any associated scheduled messages.
174
+ #
175
+ def delete()
176
+ @api.do_request("DELETE", get_base_api_path())
177
+ end
178
+
179
+ def id
180
+ get('id')
181
+ end
182
+
183
+ def content
184
+ get('content')
185
+ end
186
+
187
+ def content=(value)
188
+ set('content', value)
189
+ end
190
+
191
+ def time_of_day
192
+ get('time_of_day')
193
+ end
194
+
195
+ def time_of_day=(value)
196
+ set('time_of_day', value)
197
+ end
198
+
199
+ def date_variable
200
+ get('date_variable')
201
+ end
202
+
203
+ def date_variable=(value)
204
+ set('date_variable', value)
205
+ end
206
+
207
+ def offset_scale
208
+ get('offset_scale')
209
+ end
210
+
211
+ def offset_scale=(value)
212
+ set('offset_scale', value)
213
+ end
214
+
215
+ def offset_count
216
+ get('offset_count')
217
+ end
218
+
219
+ def offset_count=(value)
220
+ set('offset_count', value)
221
+ end
222
+
223
+ def rrule
224
+ get('rrule')
225
+ end
226
+
227
+ def rrule=(value)
228
+ set('rrule', value)
229
+ end
230
+
231
+ def end_time
232
+ get('end_time')
233
+ end
234
+
235
+ def end_time=(value)
236
+ set('end_time', value)
237
+ end
238
+
239
+ def timezone_id
240
+ get('timezone_id')
241
+ end
242
+
243
+ def timezone_id=(value)
244
+ set('timezone_id', value)
245
+ end
246
+
247
+ def recipients_str
248
+ get('recipients_str')
249
+ end
250
+
251
+ def group_id
252
+ get('group_id')
253
+ end
254
+
255
+ def group_id=(value)
256
+ set('group_id', value)
257
+ end
258
+
259
+ def contact_id
260
+ get('contact_id')
261
+ end
262
+
263
+ def contact_id=(value)
264
+ set('contact_id', value)
265
+ end
266
+
267
+ def to_number
268
+ get('to_number')
269
+ end
270
+
271
+ def to_number=(value)
272
+ set('to_number', value)
273
+ end
274
+
275
+ def route_id
276
+ get('route_id')
277
+ end
278
+
279
+ def route_id=(value)
280
+ set('route_id', value)
281
+ end
282
+
283
+ def service_id
284
+ get('service_id')
285
+ end
286
+
287
+ def service_id=(value)
288
+ set('service_id', value)
289
+ end
290
+
291
+ def audio_url
292
+ get('audio_url')
293
+ end
294
+
295
+ def audio_url=(value)
296
+ set('audio_url', value)
297
+ end
298
+
299
+ def tts_lang
300
+ get('tts_lang')
301
+ end
302
+
303
+ def tts_lang=(value)
304
+ set('tts_lang', value)
305
+ end
306
+
307
+ def tts_voice
308
+ get('tts_voice')
309
+ end
310
+
311
+ def tts_voice=(value)
312
+ set('tts_voice', value)
313
+ end
314
+
315
+ def message_type
316
+ get('message_type')
317
+ end
318
+
319
+ def time_created
320
+ get('time_created')
321
+ end
322
+
323
+ def replace_variables
324
+ get('replace_variables')
325
+ end
326
+
327
+ def replace_variables=(value)
328
+ set('replace_variables', value)
329
+ end
330
+
331
+ def track_clicks
332
+ get('track_clicks')
333
+ end
334
+
335
+ def track_clicks=(value)
336
+ set('track_clicks', value)
337
+ end
338
+
339
+ def media
340
+ get('media')
341
+ end
342
+
343
+ def route_params
344
+ get('route_params')
345
+ end
346
+
347
+ def route_params=(value)
348
+ set('route_params', value)
349
+ end
350
+
351
+ def label_ids
352
+ get('label_ids')
353
+ end
354
+
355
+ def label_ids=(value)
356
+ set('label_ids', value)
357
+ end
358
+
359
+ def project_id
360
+ get('project_id')
361
+ end
362
+
363
+ def get_base_api_path()
364
+ "/projects/#{get('project_id')}/relative_scheduled/#{get('id')}"
365
+ end
366
+
367
+ end
368
+
369
+ end
@@ -23,7 +23,12 @@ module Telerivet
23
23
  # * Updatable via API
24
24
  #
25
25
  # - vars (Hash)
26
- # * Custom variables stored for this route
26
+ # * Custom variables stored for this route. Variable names may be up to 32 characters in
27
+ # length and can contain the characters a-z, A-Z, 0-9, and _.
28
+ # Values may be strings, numbers, or boolean (true/false).
29
+ # String values may be up to 4096 bytes in length when encoded as UTF-8.
30
+ # Up to 100 variables are supported per object.
31
+ # Setting a variable to null will delete the variable.
27
32
  # * Updatable via API
28
33
  #
29
34
  # - project_id
@@ -32,7 +37,7 @@ module Telerivet
32
37
  #
33
38
  class Route < Entity
34
39
  #
35
- # Saves any fields or custom variables that have changed for this route.
40
+ # Saves any fields or custom variables that have changed for this custom route.
36
41
  #
37
42
  def save()
38
43
  super
@@ -12,17 +12,19 @@ module Telerivet
12
12
  #
13
13
  # - content
14
14
  # * Text content of the scheduled message
15
- # * Read-only
15
+ # * Updatable via API
16
16
  #
17
17
  # - rrule
18
18
  # * Recurrence rule for recurring scheduled messages, e.g. 'FREQ=MONTHLY' or
19
- # 'FREQ=WEEKLY;INTERVAL=2'; see <https://tools.ietf.org/html/rfc2445#section-4.3.10>
20
- # * Read-only
19
+ # 'FREQ=WEEKLY;INTERVAL=2'; see
20
+ # [RFC2445](https://tools.ietf.org/html/rfc2445#section-4.3.10).
21
+ # * Updatable via API
21
22
  #
22
23
  # - timezone_id
23
- # * Timezone ID used to compute times for recurring messages; see
24
- # <http://en.wikipedia.org/wiki/List_of_tz_database_time_zones>
25
- # * Read-only
24
+ # * Timezone ID used to compute times for recurring messages; see [List of tz database
25
+ # time zones Wikipedia
26
+ # article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
27
+ # * Updatable via API
26
28
  #
27
29
  # - recipients (array of objects)
28
30
  # * List of recipients. Each recipient is an object with a string `type` property, which
@@ -49,45 +51,45 @@ module Telerivet
49
51
  # - group_id
50
52
  # * ID of the group to send the message to (null if the recipient is an individual
51
53
  # contact, or if there are multiple recipients)
52
- # * Read-only
54
+ # * Updatable via API
53
55
  #
54
56
  # - contact_id
55
57
  # * ID of the contact to send the message to (null if the recipient is a group, or if
56
58
  # there are multiple recipients)
57
- # * Read-only
59
+ # * Updatable via API
58
60
  #
59
61
  # - to_number
60
62
  # * Phone number to send the message to (null if the recipient is a group, or if there
61
63
  # are multiple recipients)
62
- # * Read-only
64
+ # * Updatable via API
63
65
  #
64
66
  # - route_id
65
67
  # * ID of the phone or route the message will be sent from
66
- # * Read-only
68
+ # * Updatable via API
67
69
  #
68
70
  # - service_id (string, max 34 characters)
69
71
  # * The service associated with this message (for voice calls, the service defines the
70
72
  # call flow)
71
- # * Read-only
73
+ # * Updatable via API
72
74
  #
73
75
  # - audio_url
74
76
  # * For voice calls, the URL of an MP3 file to play when the contact answers the call
75
- # * Read-only
77
+ # * Updatable via API
76
78
  #
77
79
  # - tts_lang
78
80
  # * For voice calls, the language of the text-to-speech voice
79
81
  # * Allowed values: en-US, en-GB, en-GB-WLS, en-AU, en-IN, da-DK, nl-NL, fr-FR, fr-CA,
80
82
  # de-DE, is-IS, it-IT, pl-PL, pt-BR, pt-PT, ru-RU, es-ES, es-US, sv-SE
81
- # * Read-only
83
+ # * Updatable via API
82
84
  #
83
85
  # - tts_voice
84
86
  # * For voice calls, the text-to-speech voice
85
87
  # * Allowed values: female, male
86
- # * Read-only
88
+ # * Updatable via API
87
89
  #
88
90
  # - message_type
89
91
  # * Type of scheduled message
90
- # * Allowed values: sms, mms, ussd, call, service
92
+ # * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
91
93
  # * Read-only
92
94
  #
93
95
  # - time_created (UNIX timestamp)
@@ -96,12 +98,12 @@ module Telerivet
96
98
  #
97
99
  # - start_time (UNIX timestamp)
98
100
  # * The time that the message will be sent (or first sent for recurring messages)
99
- # * Read-only
101
+ # * Updatable via API
100
102
  #
101
103
  # - end_time (UNIX timestamp)
102
104
  # * Time after which a recurring message will stop (not applicable to non-recurring
103
105
  # scheduled messages)
104
- # * Read-only
106
+ # * Updatable via API
105
107
  #
106
108
  # - prev_time (UNIX timestamp)
107
109
  # * The most recent time that Telerivet has sent this scheduled message (null if it has
@@ -117,15 +119,15 @@ module Telerivet
117
119
  # * Number of times this scheduled message has already been sent
118
120
  # * Read-only
119
121
  #
120
- # - is_template (bool)
122
+ # - replace_variables (bool)
121
123
  # * Set to true if Telerivet will render variables like [[contact.name]] in the message
122
124
  # content, false otherwise
123
- # * Read-only
125
+ # * Updatable via API
124
126
  #
125
127
  # - track_clicks (boolean)
126
128
  # * If true, URLs in the message content will automatically be replaced with unique
127
129
  # short URLs
128
- # * Read-only
130
+ # * Updatable via API
129
131
  #
130
132
  # - media (array)
131
133
  # * For text messages containing media files, this is an array of objects with the
@@ -136,18 +138,32 @@ module Telerivet
136
138
  # * Read-only
137
139
  #
138
140
  # - route_params (Hash)
139
- # * Route-specific parameters to use when sending the message. The parameters object may
140
- # have keys matching the `phone_type` field of a phone (basic route) that may be used to
141
- # send the message. The corresponding value is an object with route-specific parameters
142
- # to use when sending a message with that type of route.
143
- # * Read-only
141
+ # * Route-specific parameters to use when sending the message.
142
+ #
143
+ # When sending messages via chat apps such as WhatsApp, the route_params
144
+ # parameter can be used to send messages with app-specific features such as quick
145
+ # replies and link buttons.
146
+ #
147
+ # For more details, see [Route-Specific Parameters](#route_params).
148
+ # * Updatable via API
144
149
  #
145
150
  # - vars (Hash)
146
- # * Custom variables stored for this scheduled message (copied to Message when sent)
151
+ # * Custom variables stored for this scheduled message (copied to Message when sent).
152
+ # Variable names may be up to 32 characters in length and can contain the characters
153
+ # a-z, A-Z, 0-9, and _.
154
+ # Values may be strings, numbers, or boolean (true/false).
155
+ # String values may be up to 4096 bytes in length when encoded as UTF-8.
156
+ # Up to 100 variables are supported per object.
157
+ # Setting a variable to null will delete the variable.
147
158
  # * Updatable via API
148
159
  #
149
160
  # - label_ids (array)
150
161
  # * IDs of labels to add to the Message
162
+ # * Updatable via API
163
+ #
164
+ # - relative_scheduled_id
165
+ # * ID of the relative scheduled message this scheduled message was created from, if
166
+ # applicable
151
167
  # * Read-only
152
168
  #
153
169
  # - project_id
@@ -177,14 +193,26 @@ class ScheduledMessage < Entity
177
193
  get('content')
178
194
  end
179
195
 
196
+ def content=(value)
197
+ set('content', value)
198
+ end
199
+
180
200
  def rrule
181
201
  get('rrule')
182
202
  end
183
203
 
204
+ def rrule=(value)
205
+ set('rrule', value)
206
+ end
207
+
184
208
  def timezone_id
185
209
  get('timezone_id')
186
210
  end
187
211
 
212
+ def timezone_id=(value)
213
+ set('timezone_id', value)
214
+ end
215
+
188
216
  def recipients
189
217
  get('recipients')
190
218
  end
@@ -197,34 +225,66 @@ class ScheduledMessage < Entity
197
225
  get('group_id')
198
226
  end
199
227
 
228
+ def group_id=(value)
229
+ set('group_id', value)
230
+ end
231
+
200
232
  def contact_id
201
233
  get('contact_id')
202
234
  end
203
235
 
236
+ def contact_id=(value)
237
+ set('contact_id', value)
238
+ end
239
+
204
240
  def to_number
205
241
  get('to_number')
206
242
  end
207
243
 
244
+ def to_number=(value)
245
+ set('to_number', value)
246
+ end
247
+
208
248
  def route_id
209
249
  get('route_id')
210
250
  end
211
251
 
252
+ def route_id=(value)
253
+ set('route_id', value)
254
+ end
255
+
212
256
  def service_id
213
257
  get('service_id')
214
258
  end
215
259
 
260
+ def service_id=(value)
261
+ set('service_id', value)
262
+ end
263
+
216
264
  def audio_url
217
265
  get('audio_url')
218
266
  end
219
267
 
268
+ def audio_url=(value)
269
+ set('audio_url', value)
270
+ end
271
+
220
272
  def tts_lang
221
273
  get('tts_lang')
222
274
  end
223
275
 
276
+ def tts_lang=(value)
277
+ set('tts_lang', value)
278
+ end
279
+
224
280
  def tts_voice
225
281
  get('tts_voice')
226
282
  end
227
283
 
284
+ def tts_voice=(value)
285
+ set('tts_voice', value)
286
+ end
287
+
228
288
  def message_type
229
289
  get('message_type')
230
290
  end
@@ -237,10 +297,18 @@ class ScheduledMessage < Entity
237
297
  get('start_time')
238
298
  end
239
299
 
300
+ def start_time=(value)
301
+ set('start_time', value)
302
+ end
303
+
240
304
  def end_time
241
305
  get('end_time')
242
306
  end
243
307
 
308
+ def end_time=(value)
309
+ set('end_time', value)
310
+ end
311
+
244
312
  def prev_time
245
313
  get('prev_time')
246
314
  end
@@ -253,14 +321,22 @@ class ScheduledMessage < Entity
253
321
  get('occurrences')
254
322
  end
255
323
 
256
- def is_template
257
- get('is_template')
324
+ def replace_variables
325
+ get('replace_variables')
326
+ end
327
+
328
+ def replace_variables=(value)
329
+ set('replace_variables', value)
258
330
  end
259
331
 
260
332
  def track_clicks
261
333
  get('track_clicks')
262
334
  end
263
335
 
336
+ def track_clicks=(value)
337
+ set('track_clicks', value)
338
+ end
339
+
264
340
  def media
265
341
  get('media')
266
342
  end
@@ -269,10 +345,22 @@ class ScheduledMessage < Entity
269
345
  get('route_params')
270
346
  end
271
347
 
348
+ def route_params=(value)
349
+ set('route_params', value)
350
+ end
351
+
272
352
  def label_ids
273
353
  get('label_ids')
274
354
  end
275
355
 
356
+ def label_ids=(value)
357
+ set('label_ids', value)
358
+ end
359
+
360
+ def relative_scheduled_id
361
+ get('relative_scheduled_id')
362
+ end
363
+
276
364
  def project_id
277
365
  get('project_id')
278
366
  end