telerivet 1.5.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e063e2ce507f6d45b86d12c584475887c050c3d439863d91d545b0ba331e823
4
- data.tar.gz: d8040eb663854c7df190aa8f49984d9854687238532b6278af53dea6ebc77250
3
+ metadata.gz: 303a6df0ce9d23233621cac3732ab09afb1b9bf968d784441e29bd343a4ec105
4
+ data.tar.gz: fad6a45b9e7b0cd84668f49a129a6600b3fcd4898b18d193d476deede36c9323
5
5
  SHA512:
6
- metadata.gz: da5e09e1c639a5e1bd3b704214c4a276d62469e6ae0853d71cbe4b9dc2a2aacbb1f58d5e5bcbf1093e5cbf24a7a99abcf30d029883aca055d4b41ae9f3a7f8ff
7
- data.tar.gz: 4ad80ced036f9d8810e3e7f693443247740791ed4097b26ce179c2c2ef0ca06986b41942fde40401ea8989df19591f84834439efb74900f9bb57ec7f939d8f25
6
+ metadata.gz: 4b030343b0e5d79d4c1d520d348baccfe77a7d171fab5b86f1f3a0b16e914f82ad3c5eab796fd2ddcec3480a1f952e030208f5db2eaaa568b3eb079fddbaa1ca
7
+ data.tar.gz: a8c12e9cfbb08f568f40cb4647646d033aa55d1864b1acd28219ff27d587d04ef2bff994b8aa0ab43c3082446de03bebe2ad90a99ba25a22ea40700505954e68
@@ -144,6 +144,13 @@ module Telerivet
144
144
  # * Custom variables stored for this broadcast
145
145
  # * Read-only
146
146
  #
147
+ # - route_params (Hash)
148
+ # * Route-specific parameters for the messages in the broadcast. The parameters object
149
+ # may have keys matching the `phone_type` field of a phone (basic route) that may be
150
+ # used to send messages in this broadcast. The corresponding value is an object with
151
+ # route-specific parameters to use when sending messages with that type of route.
152
+ # * Read-only
153
+ #
147
154
  # - price (number)
148
155
  # * The total price of all messages in this broadcast, if known.
149
156
  # * Read-only
@@ -282,6 +289,10 @@ class Broadcast < Entity
282
289
  get('media')
283
290
  end
284
291
 
292
+ def route_params
293
+ get('route_params')
294
+ end
295
+
285
296
  def price
286
297
  get('price')
287
298
  end
@@ -147,7 +147,7 @@ class Contact < Entity
147
147
  # - status
148
148
  # * Filter messages by status
149
149
  # * Allowed values: ignored, processing, received, sent, queued, failed,
150
- # failed_queued, cancelled, delivered, not_delivered
150
+ # failed_queued, cancelled, delivered, not_delivered, read
151
151
  #
152
152
  # - time_created[min] (UNIX timestamp)
153
153
  # * Filter messages created on or after a particular time
@@ -157,18 +157,26 @@ class Contact < Entity
157
157
  #
158
158
  # - external_id
159
159
  # * Filter messages by ID from an external provider
160
+ # * Allowed modifiers: external_id[ne], external_id[exists]
160
161
  #
161
162
  # - contact_id
162
163
  # * ID of the contact who sent/received the message
164
+ # * Allowed modifiers: contact_id[ne], contact_id[exists]
163
165
  #
164
166
  # - phone_id
165
167
  # * ID of the phone (basic route) that sent/received the message
166
168
  #
167
169
  # - broadcast_id
168
170
  # * ID of the broadcast containing the message
171
+ # * Allowed modifiers: broadcast_id[ne], broadcast_id[exists]
169
172
  #
170
173
  # - scheduled_id
171
174
  # * ID of the scheduled message that created this message
175
+ # * Allowed modifiers: scheduled_id[ne], scheduled_id[exists]
176
+ #
177
+ # - group_id
178
+ # * Filter messages sent or received by contacts in a particular group. The group must
179
+ # be a normal group, not a dynamic group.
172
180
  #
173
181
  # - sort
174
182
  # * Sort the results based on a field
@@ -249,16 +257,15 @@ class Contact < Entity
249
257
  #
250
258
  # - time_created (UNIX timestamp)
251
259
  # * Filter scheduled messages by time_created
252
- # * Allowed modifiers: time_created[ne], time_created[min], time_created[max]
260
+ # * Allowed modifiers: time_created[min], time_created[max]
253
261
  #
254
262
  # - next_time (UNIX timestamp)
255
263
  # * Filter scheduled messages by next_time
256
- # * Allowed modifiers: next_time[ne], next_time[min], next_time[max],
257
- # next_time[exists]
264
+ # * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
258
265
  #
259
266
  # - sort
260
267
  # * Sort the results based on a field
261
- # * Allowed values: default, name
268
+ # * Allowed values: default, next_time
262
269
  # * Default: default
263
270
  #
264
271
  # - sort_dir
@@ -290,7 +297,7 @@ class Contact < Entity
290
297
  #
291
298
  # - time_created (UNIX timestamp)
292
299
  # * Filter data rows by the time they were created
293
- # * Allowed modifiers: time_created[ne], time_created[min], time_created[max]
300
+ # * Allowed modifiers: time_created[min], time_created[max]
294
301
  #
295
302
  # - sort
296
303
  # * Sort the results based on a field
@@ -55,7 +55,7 @@ class DataTable < Entity
55
55
  #
56
56
  # - time_created (UNIX timestamp)
57
57
  # * Filter data rows by the time they were created
58
- # * Allowed modifiers: time_created[ne], time_created[min], time_created[max]
58
+ # * Allowed modifiers: time_created[min], time_created[max]
59
59
  #
60
60
  # - contact_id
61
61
  # * Filter data rows associated with a particular contact
@@ -169,25 +169,36 @@ class DataTable < Entity
169
169
  # * Required
170
170
  #
171
171
  # - options (Hash)
172
+ # * Required
172
173
  #
173
174
  # - name (string, max 64 characters)
174
175
  # * Display name for the field
175
176
  #
176
177
  # - type (string)
177
178
  # * Field type
178
- # * Allowed values: text, long_text, number, boolean, email, url, audio, phone_number,
179
- # date, date_time, groups, route, select, buttons, contact
179
+ # * Allowed values: text, long_text, phone_number, email, url, audio, date, date_time,
180
+ # number, boolean, select
180
181
  #
181
182
  # - order (int)
182
183
  # * Order in which to display the field
183
184
  #
185
+ # - items (array)
186
+ # * Array of up to 100 objects containing `value` and `label` string properties to
187
+ # show in the dropdown list when type is `select`. Each `value` and `label` must be
188
+ # between 1 and 256 characters in length.
189
+ # * Required if type is `select`
190
+ #
184
191
  # - readonly (bool)
185
192
  # * Set to true to prevent editing the field in the Telerivet web app
193
+ #
194
+ # - lookup_key (bool)
195
+ # * Set to true to allow using this field as a lookup key when importing rows via the
196
+ # Telerivet web app
186
197
  #
187
198
  # Returns:
188
199
  # object
189
200
  #
190
- def set_field_metadata(variable, options = nil)
201
+ def set_field_metadata(variable, options)
191
202
  return @api.do_request("POST", get_base_api_path() + "/fields/#{variable}", options)
192
203
  end
193
204
 
@@ -54,24 +54,22 @@ class Group < Entity
54
54
  #
55
55
  # - time_created (UNIX timestamp)
56
56
  # * Filter contacts by time created
57
- # * Allowed modifiers: time_created[ne], time_created[min], time_created[max]
57
+ # * Allowed modifiers: time_created[min], time_created[max]
58
58
  #
59
59
  # - last_message_time (UNIX timestamp)
60
60
  # * Filter contacts by last time a message was sent or received
61
- # * Allowed modifiers: last_message_time[ne], last_message_time[min],
62
- # last_message_time[max], last_message_time[exists]
61
+ # * Allowed modifiers: last_message_time[min], last_message_time[max],
62
+ # last_message_time[exists]
63
63
  #
64
64
  # - last_incoming_message_time (UNIX timestamp)
65
65
  # * Filter contacts by last time a message was received
66
- # * Allowed modifiers: last_incoming_message_time[ne],
67
- # last_incoming_message_time[min], last_incoming_message_time[max],
68
- # last_incoming_message_time[exists]
66
+ # * Allowed modifiers: last_incoming_message_time[min],
67
+ # last_incoming_message_time[max], last_incoming_message_time[exists]
69
68
  #
70
69
  # - last_outgoing_message_time (UNIX timestamp)
71
70
  # * Filter contacts by last time a message was sent
72
- # * Allowed modifiers: last_outgoing_message_time[ne],
73
- # last_outgoing_message_time[min], last_outgoing_message_time[max],
74
- # last_outgoing_message_time[exists]
71
+ # * Allowed modifiers: last_outgoing_message_time[min],
72
+ # last_outgoing_message_time[max], last_outgoing_message_time[exists]
75
73
  #
76
74
  # - incoming_message_count (int)
77
75
  # * Filter contacts by number of messages received from the contact
@@ -130,16 +128,15 @@ class Group < Entity
130
128
  #
131
129
  # - time_created (UNIX timestamp)
132
130
  # * Filter scheduled messages by time_created
133
- # * Allowed modifiers: time_created[ne], time_created[min], time_created[max]
131
+ # * Allowed modifiers: time_created[min], time_created[max]
134
132
  #
135
133
  # - next_time (UNIX timestamp)
136
134
  # * Filter scheduled messages by next_time
137
- # * Allowed modifiers: next_time[ne], next_time[min], next_time[max],
138
- # next_time[exists]
135
+ # * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
139
136
  #
140
137
  # - sort
141
138
  # * Sort the results based on a field
142
- # * Allowed values: default, name
139
+ # * Allowed values: default, next_time
143
140
  # * Default: default
144
141
  #
145
142
  # - sort_dir
@@ -52,7 +52,7 @@ class Label < Entity
52
52
  # - status
53
53
  # * Filter messages by status
54
54
  # * Allowed values: ignored, processing, received, sent, queued, failed,
55
- # failed_queued, cancelled, delivered, not_delivered
55
+ # failed_queued, cancelled, delivered, not_delivered, read
56
56
  #
57
57
  # - time_created[min] (UNIX timestamp)
58
58
  # * Filter messages created on or after a particular time
@@ -62,18 +62,26 @@ class Label < Entity
62
62
  #
63
63
  # - external_id
64
64
  # * Filter messages by ID from an external provider
65
+ # * Allowed modifiers: external_id[ne], external_id[exists]
65
66
  #
66
67
  # - contact_id
67
68
  # * ID of the contact who sent/received the message
69
+ # * Allowed modifiers: contact_id[ne], contact_id[exists]
68
70
  #
69
71
  # - phone_id
70
72
  # * ID of the phone (basic route) that sent/received the message
71
73
  #
72
74
  # - broadcast_id
73
75
  # * ID of the broadcast containing the message
76
+ # * Allowed modifiers: broadcast_id[ne], broadcast_id[exists]
74
77
  #
75
78
  # - scheduled_id
76
79
  # * ID of the scheduled message that created this message
80
+ # * Allowed modifiers: scheduled_id[ne], scheduled_id[exists]
81
+ #
82
+ # - group_id
83
+ # * Filter messages sent or received by contacts in a particular group. The group must
84
+ # be a normal group, not a dynamic group.
77
85
  #
78
86
  # - sort
79
87
  # * Sort the results based on a field
@@ -18,7 +18,7 @@ module Telerivet
18
18
  # - status
19
19
  # * Current status of the message
20
20
  # * Allowed values: ignored, processing, received, sent, queued, failed, failed_queued,
21
- # cancelled, delivered, not_delivered
21
+ # cancelled, delivered, not_delivered, read
22
22
  # * Read-only
23
23
  #
24
24
  # - message_type
@@ -71,6 +71,13 @@ module Telerivet
71
71
  # * List of IDs of labels applied to this message
72
72
  # * Read-only
73
73
  #
74
+ # - route_params (Hash)
75
+ # * Route-specific parameters for the message. The parameters object may have keys
76
+ # matching the `phone_type` field of a phone (basic route) that may be used to send the
77
+ # message. The corresponding value is an object with route-specific parameters to use
78
+ # when the message is sent by that type of route.
79
+ # * Read-only
80
+ #
74
81
  # - vars (Hash)
75
82
  # * Custom variables stored for this message
76
83
  # * Updatable via API
@@ -122,15 +129,6 @@ module Telerivet
122
129
  # * Allowed values: female, male
123
130
  # * Read-only
124
131
  #
125
- # - mms_parts (array)
126
- # * A list of parts in the MMS message, the same as returned by the
127
- # [getMMSParts](#Message.getMMSParts) method.
128
- #
129
- # Note: This property is only present when retrieving an individual
130
- # MMS message by ID, not when querying a list of messages. In other cases, use
131
- # [getMMSParts](#Message.getMMSParts).
132
- # * Read-only
133
- #
134
132
  # - track_clicks (boolean)
135
133
  # * If true, URLs in the message content are short URLs that redirect to a destination
136
134
  # URL.
@@ -138,12 +136,12 @@ module Telerivet
138
136
  #
139
137
  # - short_urls (array)
140
138
  # * For text messages containing short URLs, this is an array of objects with the
141
- # properties `short_url`, `link_type`, and `time_clicked` (the first time that URL was
142
- # clicked). If `link_type` is "redirect", the object also contains a `destination_url`
143
- # property. If `link_type` is "media", the object also contains an `media_index`
144
- # property (the index in the media array). If `link_type` is "service", the object also
145
- # contains a `service_id` property. This property is undefined for messages that do not
146
- # contain short URLs.
139
+ # properties `short_url`, `link_type`, `time_clicked` (the first time that URL was
140
+ # clicked), and `expiration_time`. If `link_type` is "redirect", the object also
141
+ # contains a `destination_url` property. If `link_type` is "media", the object also
142
+ # contains an `media_index` property (the index in the media array). If `link_type` is
143
+ # "service", the object also contains a `service_id` property. This property is
144
+ # undefined for messages that do not contain short URLs.
147
145
  # * Read-only
148
146
  #
149
147
  # - media (array)
@@ -154,6 +152,27 @@ module Telerivet
154
152
  # temporary and may not be valid for more than 1 day.
155
153
  # * Read-only
156
154
  #
155
+ # - mms_parts (array)
156
+ # * A list of parts in the MMS message (only for incoming MMS messages received via
157
+ # Telerivet Gateway Android app).
158
+ #
159
+ # Each MMS part in the list is an object with the following
160
+ # properties:
161
+ #
162
+ # - cid: MMS content-id
163
+ # - type: MIME type
164
+ # - filename: original filename
165
+ # - size (int): number of bytes
166
+ # - url: URL where the content for this part is stored (secret but
167
+ # publicly accessible, so you could link/embed it in a web page without having to
168
+ # re-host it yourself)
169
+ #
170
+ # In general, the `media` property of the message is recommended for
171
+ # retrieving information about MMS media files, instead of `mms_parts`.
172
+ # The `mms_parts` property is also only present when retrieving an
173
+ # individual MMS message by ID, not when querying a list of messages.
174
+ # * Read-only
175
+ #
157
176
  # - time_clicked (UNIX timestamp)
158
177
  # * If the message contains any short URLs, this is the first time that a short URL in
159
178
  # the message was clicked. This property is undefined for messages that do not contain
@@ -237,18 +256,15 @@ class Message < Entity
237
256
  end
238
257
 
239
258
  #
240
- # Retrieves a list of MMS parts for this message (empty for non-MMS messages).
259
+ # (Deprecated) Retrieves a list of MMS parts for this message (only for incoming MMS messages
260
+ # received via Telerivet Gateway Android app).
261
+ # Note: This only works for MMS messages received via the Telerivet
262
+ # Gateway Android app.
263
+ # In general, the `media` property of the message is recommended for
264
+ # retrieving information about MMS media files.
241
265
  #
242
- # Each MMS part in the list is an object with the following
243
- # properties:
244
- #
245
- # - cid: MMS content-id
246
- # - type: MIME type
247
- # - filename: original filename
248
- # - size (int): number of bytes
249
- # - url: URL where the content for this part is stored (secret but
250
- # publicly accessible, so you could link/embed it in a web page without having to re-host it
251
- # yourself)
266
+ # The return value has the same format as the `mms_parts` property of
267
+ # the Message object.
252
268
  #
253
269
  # Returns:
254
270
  # array
@@ -364,6 +380,10 @@ class Message < Entity
364
380
  get('label_ids')
365
381
  end
366
382
 
383
+ def route_params
384
+ get('route_params')
385
+ end
386
+
367
387
  def priority
368
388
  get('priority')
369
389
  end
@@ -408,10 +428,6 @@ class Message < Entity
408
428
  get('tts_voice')
409
429
  end
410
430
 
411
- def mms_parts
412
- get('mms_parts')
413
- end
414
-
415
431
  def track_clicks
416
432
  get('track_clicks')
417
433
  end
@@ -424,6 +440,10 @@ class Message < Entity
424
440
  get('media')
425
441
  end
426
442
 
443
+ def mms_parts
444
+ get('mms_parts')
445
+ end
446
+
427
447
  def time_clicked
428
448
  get('time_clicked')
429
449
  end
@@ -98,6 +98,86 @@ class Organization < Entity
98
98
  return @api.do_request("GET", get_base_api_path() + "/usage/#{usage_type}")
99
99
  end
100
100
 
101
+ #
102
+ # Retrieves statistics about messages sent or received via Telerivet. This endpoint returns
103
+ # historical data that is computed shortly after midnight each day in the project's time zone,
104
+ # and does not contain message statistics for the current day.
105
+ #
106
+ # Arguments:
107
+ # - options (Hash)
108
+ # * Required
109
+ #
110
+ # - start_date (string)
111
+ # * Start date of message statistics, in YYYY-MM-DD format
112
+ # * Required
113
+ #
114
+ # - end_date (string)
115
+ # * End date of message statistics (inclusive), in YYYY-MM-DD format
116
+ # * Required
117
+ #
118
+ # - rollup (string)
119
+ # * Date interval to group by
120
+ # * Allowed values: day, week, month, year, all
121
+ # * Default: day
122
+ #
123
+ # - properties (string)
124
+ # * Comma separated list of properties to group by
125
+ # * Allowed values: org_id, org_name, org_industry, project_id, project_name, user_id,
126
+ # user_email, user_name, phone_id, phone_name, phone_type, direction, source, status,
127
+ # network_code, network_name, message_type, service_id, service_name, simulated, link
128
+ #
129
+ # - metrics (string)
130
+ # * Comma separated list of metrics to return (summed for each distinct value of the
131
+ # requested properties)
132
+ # * Allowed values: count, num_parts, duration, price
133
+ # * Required
134
+ #
135
+ # - currency (string)
136
+ # * Three-letter ISO 4217 currency code used when returning the 'price' field. If the
137
+ # original price was in a different currency, it will be converted to the requested
138
+ # currency using the approximate current exchange rate.
139
+ # * Default: USD
140
+ #
141
+ # - filters (Hash)
142
+ # * Key-value pairs of properties and corresponding values; the returned statistics
143
+ # will only include messages where the property matches the provided value. Only the
144
+ # following properties are supported for filters: `user_id`, `phone_id`, `direction`,
145
+ # `source`, `status`, `service_id`, `simulated`, `message_type`, `network_code`
146
+ #
147
+ # Returns:
148
+ # (associative array)
149
+ # - intervals (array)
150
+ # * List of objects representing each date interval containing at least one message
151
+ # matching the filters.
152
+ # Each object has the following properties:
153
+ #
154
+ # <table>
155
+ # <tr><td> start_time </td> <td> The UNIX timestamp of the start
156
+ # of the interval (int) </td></tr>
157
+ # <tr><td> end_time </td> <td> The UNIX timestamp of the end of
158
+ # the interval, exclusive (int) </td></tr>
159
+ # <tr><td> start_date </td> <td> The date of the start of the
160
+ # interval in YYYY-MM-DD format (string) </td></tr>
161
+ # <tr><td> end_date </td> <td> The date of the end of the
162
+ # interval in YYYY-MM-DD format, inclusive (string) </td></tr>
163
+ # <tr><td> groups </td> <td> Array of groups for each
164
+ # combination of requested property values matching the filters (array)
165
+ # <br /><br />
166
+ # Each object has the following properties:
167
+ # <table>
168
+ # <tr><td> properties </td> <td> An object of key/value
169
+ # pairs for each distinct value of the requested properties (object) </td></tr>
170
+ # <tr><td> metrics </td> <td> An object of key/value pairs
171
+ # for each requested metric (object) </td></tr>
172
+ # </table>
173
+ # </td></tr>
174
+ # </table>
175
+ #
176
+ def get_message_stats(options)
177
+ data = @api.do_request("GET", get_base_api_path() + "/message_stats", options)
178
+ return data
179
+ end
180
+
101
181
  #
102
182
  # Queries projects in this organization.
103
183
  #
@@ -124,7 +124,7 @@ class Phone < Entity
124
124
  # - status
125
125
  # * Filter messages by status
126
126
  # * Allowed values: ignored, processing, received, sent, queued, failed,
127
- # failed_queued, cancelled, delivered, not_delivered
127
+ # failed_queued, cancelled, delivered, not_delivered, read
128
128
  #
129
129
  # - time_created[min] (UNIX timestamp)
130
130
  # * Filter messages created on or after a particular time
@@ -134,18 +134,26 @@ class Phone < Entity
134
134
  #
135
135
  # - external_id
136
136
  # * Filter messages by ID from an external provider
137
+ # * Allowed modifiers: external_id[ne], external_id[exists]
137
138
  #
138
139
  # - contact_id
139
140
  # * ID of the contact who sent/received the message
141
+ # * Allowed modifiers: contact_id[ne], contact_id[exists]
140
142
  #
141
143
  # - phone_id
142
144
  # * ID of the phone (basic route) that sent/received the message
143
145
  #
144
146
  # - broadcast_id
145
147
  # * ID of the broadcast containing the message
148
+ # * Allowed modifiers: broadcast_id[ne], broadcast_id[exists]
146
149
  #
147
150
  # - scheduled_id
148
151
  # * ID of the scheduled message that created this message
152
+ # * Allowed modifiers: scheduled_id[ne], scheduled_id[exists]
153
+ #
154
+ # - group_id
155
+ # * Filter messages sent or received by contacts in a particular group. The group must
156
+ # be a normal group, not a dynamic group.
149
157
  #
150
158
  # - sort
151
159
  # * Sort the results based on a field
@@ -82,11 +82,31 @@ class Project < Entity
82
82
  # short URLs.
83
83
  # * Default: false
84
84
  #
85
+ # - short_link_params (Hash)
86
+ # *
87
+ # If `track_clicks` is true, `short_link_params` may be used to specify
88
+ # custom parameters for each short link in the message. The following parameters are
89
+ # supported:
90
+ #
91
+ # `domain` (string): A custom short domain name to use for the short
92
+ # links. The domain name must already be registered for your project or organization.
93
+ #
94
+ # `expiration_sec` (integer): The number of seconds after the message is
95
+ # created (queued to send) when the short links will stop forwarding to the
96
+ # destination URL.
97
+ # If null, the short links will not expire.
98
+ #
85
99
  # - media_urls (array)
86
100
  # * URLs of media files to attach to the text message. If `message_type` is `sms`,
87
101
  # short links to each media URL will be appended to the end of the content (separated
88
102
  # by a new line).
89
103
  #
104
+ # - route_params (Hash)
105
+ # * Route-specific parameters for the message. The parameters object should have one
106
+ # or more keys matching the `phone_type` field of a phone (basic route) that may be
107
+ # used to send the message. The corresponding value should be an object with
108
+ # route-specific parameters to use if the message is sent by that type of route.
109
+ #
90
110
  # - label_ids (array)
91
111
  # * List of IDs of labels to add to this message
92
112
  #
@@ -202,6 +222,20 @@ class Project < Entity
202
222
  # short URLs.
203
223
  # * Default: false
204
224
  #
225
+ # - short_link_params (Hash)
226
+ # *
227
+ # If `track_clicks` is true, `short_link_params` may be used to specify
228
+ # custom parameters for each short link in the message. The following parameters are
229
+ # supported:
230
+ #
231
+ # `domain` (string): A custom short domain name to use for the short
232
+ # links. The domain name must already be registered for your project or organization.
233
+ #
234
+ # `expiration_sec` (integer): The number of seconds after the message is
235
+ # created (queued to send) when the short links will stop forwarding to the
236
+ # destination URL.
237
+ # If null, the short links will not expire.
238
+ #
205
239
  # - media_urls (array)
206
240
  # * URLs of media files to attach to the text message. If `message_type` is `sms`,
207
241
  # short links to each URL will be appended to the end of the content (separated by a
@@ -210,6 +244,12 @@ class Project < Entity
210
244
  # - vars (Hash)
211
245
  # * Custom variables to set for each message
212
246
  #
247
+ # - route_params (Hash)
248
+ # * Route-specific parameters for the messages in the broadcast. The parameters object
249
+ # may have keys matching the `phone_type` field of a phone (basic route) that may be
250
+ # used to send messages in this broadcast. The corresponding value is an object with
251
+ # route-specific parameters to use when sending messages with that type of route.
252
+ #
213
253
  # - service_id
214
254
  # * Service to invoke for each recipient (when `message_type` is `call` or `service`)
215
255
  # * Required if message_type is service
@@ -295,11 +335,36 @@ class Project < Entity
295
335
  # available variables)](#variables)
296
336
  # * Default: false
297
337
  #
338
+ # - track_clicks (boolean)
339
+ # * If true, URLs in the message content will automatically be replaced with unique
340
+ # short URLs.
341
+ # * Default: false
342
+ #
343
+ # - short_link_params (Hash)
344
+ # *
345
+ # If `track_clicks` is true, `short_link_params` may be used to specify
346
+ # custom parameters for each short link in the message. The following parameters are
347
+ # supported:
348
+ #
349
+ # `domain` (string): A custom short domain name to use for the short
350
+ # links. The domain name must already be registered for your project or organization.
351
+ #
352
+ # `expiration_sec` (integer): The number of seconds after the message is
353
+ # created (queued to send) when the short links will stop forwarding to the
354
+ # destination URL.
355
+ # If null, the short links will not expire.
356
+ #
298
357
  # - media_urls (array)
299
358
  # * URLs of media files to attach to the text message. If `message_type` is `sms`,
300
359
  # short links to each media URL will be appended to the end of the content (separated
301
360
  # by a new line).
302
361
  #
362
+ # - route_params (Hash)
363
+ # * Route-specific parameters to apply to all messages. The parameters object may have
364
+ # keys matching the `phone_type` field of a phone (basic route) that may be used to
365
+ # send messages. The corresponding value is an object with route-specific parameters
366
+ # to use when sending messages with that type of route.
367
+ #
303
368
  # - vars (Hash)
304
369
  # * Custom variables to store with the message
305
370
  #
@@ -325,6 +390,10 @@ class Project < Entity
325
390
  # (Other properties of the Message object are
326
391
  # omitted in order to reduce the amount of redundant data sent in each API
327
392
  # response.)
393
+ # If the `messages` parameter in the API request
394
+ # contains items with `to_number` values that are associated with blocked contacts,
395
+ # the `id` and `status` properties corresponding to those items will be null, and no
396
+ # messages will be sent to those numbers.
328
397
  #
329
398
  # - broadcast_id
330
399
  # * ID of broadcast that these messages are associated with, if `broadcast_id` or
@@ -447,6 +516,20 @@ class Project < Entity
447
516
  # short URLs.
448
517
  # * Default: false
449
518
  #
519
+ # - short_link_params (Hash)
520
+ # *
521
+ # If `track_clicks` is true, `short_link_params` may be used to specify
522
+ # custom parameters for each short link in the message. The following parameters are
523
+ # supported:
524
+ #
525
+ # `domain` (string): A custom short domain name to use for the short
526
+ # links. The domain name must already be registered for your project or organization.
527
+ #
528
+ # `expiration_sec` (integer): The number of seconds after the message is
529
+ # created (queued to send) when the short links will stop forwarding to the
530
+ # destination URL.
531
+ # If null, the short links will not expire.
532
+ #
450
533
  # - is_template (bool)
451
534
  # * Set to true to evaluate variables like [[contact.name]] in message content
452
535
  # * Default: false
@@ -456,6 +539,12 @@ class Project < Entity
456
539
  # short links to each media URL will be appended to the end of the content (separated
457
540
  # by a new line).
458
541
  #
542
+ # - route_params (Hash)
543
+ # * Route-specific parameters to use when sending the message. The parameters object
544
+ # may have keys matching the `phone_type` field of a phone (basic route) that may be
545
+ # used to send the message. The corresponding value is an object with route-specific
546
+ # parameters to use when sending a message with that type of route.
547
+ #
459
548
  # - label_ids (array)
460
549
  # * Array of IDs of labels to add to the sent messages (maximum 5). Does not apply
461
550
  # when `message_type`=`service`, since the labels are determined by the service
@@ -664,24 +753,22 @@ class Project < Entity
664
753
  #
665
754
  # - time_created (UNIX timestamp)
666
755
  # * Filter contacts by time created
667
- # * Allowed modifiers: time_created[ne], time_created[min], time_created[max]
756
+ # * Allowed modifiers: time_created[min], time_created[max]
668
757
  #
669
758
  # - last_message_time (UNIX timestamp)
670
759
  # * Filter contacts by last time a message was sent or received
671
- # * Allowed modifiers: last_message_time[ne], last_message_time[min],
672
- # last_message_time[max], last_message_time[exists]
760
+ # * Allowed modifiers: last_message_time[min], last_message_time[max],
761
+ # last_message_time[exists]
673
762
  #
674
763
  # - last_incoming_message_time (UNIX timestamp)
675
764
  # * Filter contacts by last time a message was received
676
- # * Allowed modifiers: last_incoming_message_time[ne],
677
- # last_incoming_message_time[min], last_incoming_message_time[max],
678
- # last_incoming_message_time[exists]
765
+ # * Allowed modifiers: last_incoming_message_time[min],
766
+ # last_incoming_message_time[max], last_incoming_message_time[exists]
679
767
  #
680
768
  # - last_outgoing_message_time (UNIX timestamp)
681
769
  # * Filter contacts by last time a message was sent
682
- # * Allowed modifiers: last_outgoing_message_time[ne],
683
- # last_outgoing_message_time[min], last_outgoing_message_time[max],
684
- # last_outgoing_message_time[exists]
770
+ # * Allowed modifiers: last_outgoing_message_time[min],
771
+ # last_outgoing_message_time[max], last_outgoing_message_time[exists]
685
772
  #
686
773
  # - incoming_message_count (int)
687
774
  # * Filter contacts by number of messages received from the contact
@@ -779,8 +866,8 @@ class Project < Entity
779
866
  #
780
867
  # - last_active_time (UNIX timestamp)
781
868
  # * Filter phones by last active time
782
- # * Allowed modifiers: last_active_time[ne], last_active_time[min],
783
- # last_active_time[max], last_active_time[exists]
869
+ # * Allowed modifiers: last_active_time[min], last_active_time[max],
870
+ # last_active_time[exists]
784
871
  #
785
872
  # - sort
786
873
  # * Sort the results based on a field
@@ -868,7 +955,7 @@ class Project < Entity
868
955
  # - status
869
956
  # * Filter messages by status
870
957
  # * Allowed values: ignored, processing, received, sent, queued, failed,
871
- # failed_queued, cancelled, delivered, not_delivered
958
+ # failed_queued, cancelled, delivered, not_delivered, read
872
959
  #
873
960
  # - time_created[min] (UNIX timestamp)
874
961
  # * Filter messages created on or after a particular time
@@ -878,18 +965,26 @@ class Project < Entity
878
965
  #
879
966
  # - external_id
880
967
  # * Filter messages by ID from an external provider
968
+ # * Allowed modifiers: external_id[ne], external_id[exists]
881
969
  #
882
970
  # - contact_id
883
971
  # * ID of the contact who sent/received the message
972
+ # * Allowed modifiers: contact_id[ne], contact_id[exists]
884
973
  #
885
974
  # - phone_id
886
975
  # * ID of the phone (basic route) that sent/received the message
887
976
  #
888
977
  # - broadcast_id
889
978
  # * ID of the broadcast containing the message
979
+ # * Allowed modifiers: broadcast_id[ne], broadcast_id[exists]
890
980
  #
891
981
  # - scheduled_id
892
982
  # * ID of the scheduled message that created this message
983
+ # * Allowed modifiers: scheduled_id[ne], scheduled_id[exists]
984
+ #
985
+ # - group_id
986
+ # * Filter messages sent or received by contacts in a particular group. The group must
987
+ # be a normal group, not a dynamic group.
893
988
  #
894
989
  # - sort
895
990
  # * Sort the results based on a field
@@ -1100,8 +1195,16 @@ class Project < Entity
1100
1195
  # <table>
1101
1196
  # <tr><td> `service_id` </td> <td> The ID of the
1102
1197
  # service to apply (string) </td></tr>
1198
+ # <tr><td> `variables` </td> <td> Optional object
1199
+ # containing up to 25 temporary variable names and their corresponding values to set
1200
+ # when invoking the service. Values may be strings, numbers, or boolean (true/false).
1201
+ # String values may be up to 4096 bytes in length. Arrays and objects are not
1202
+ # supported. Within Custom Actions, each variable can be used like [[$name]] (with a
1203
+ # leading $ character and surrounded by double square brackets). Within a Cloud Script
1204
+ # API service or JavaScript action, each variable will be available as a global
1205
+ # JavaScript variable like $name (with a leading $ character). (object) </td></tr>
1103
1206
  # </table>
1104
- #
1207
+ # <br />
1105
1208
  # **`update_contact_var`**, **`update_message_var`**,
1106
1209
  # **`update_row_var`**:
1107
1210
  # <table>
@@ -1110,50 +1213,50 @@ class Project < Entity
1110
1213
  # <tr><td> `value` </td> <td> The value to set
1111
1214
  # (string, boolean, float, null) </td></tr>
1112
1215
  # </table>
1113
- #
1216
+ # <br />
1114
1217
  # **`add_group_members`**, **`remove_group_members`**:
1115
1218
  # <table>
1116
1219
  # <tr><td> `group_id` </td> <td> The ID of the group
1117
1220
  # (string) </td></tr>
1118
1221
  # </table>
1119
- #
1222
+ # <br />
1120
1223
  # **`add_label`**, **`remove_label`**:
1121
1224
  # <table>
1122
1225
  # <tr><td> `label_id` </td> <td> The ID of the label
1123
1226
  # (string) </td></tr>
1124
1227
  # </table>
1125
- #
1228
+ # <br />
1126
1229
  # **`resend_messages`**:
1127
1230
  # <table>
1128
1231
  # <tr><td> `route_id` </td> <td> ID of the new route
1129
1232
  # to use, or null to use the original route (string) </td></tr>
1130
1233
  # </table>
1131
- #
1234
+ # <br />
1132
1235
  # **`set_send_blocked`**:
1133
1236
  # <table>
1134
1237
  # <tr><td> `send_blocked` </td> <td> `true` to block
1135
1238
  # sending messages, `false` to unblock sending messages (boolean) </td></tr>
1136
1239
  # </table>
1137
- #
1240
+ # <br />
1138
1241
  # **`set_conversation_status`**:
1139
1242
  # <table>
1140
1243
  # <tr><td> `conversation_status` </td> <td> "active",
1141
1244
  # "handled", or "closed" (string) </td></tr>
1142
1245
  # </table>
1143
- #
1246
+ # <br />
1144
1247
  # **`export_contacts`**, **`export_messages`**,
1145
1248
  # **`export_rows`**:
1146
1249
  # <table>
1147
1250
  # <tr><td>`storage_id` </td> <td> ID of a storage
1148
- # backend where the CSV file will be saved. (string)
1251
+ # provider where the CSV file will be saved. (string)
1149
1252
  #
1150
1253
  # Currently only AWS S3 is supported as a storage
1151
- # backend.
1254
+ # provider.
1152
1255
  # This requires creating a S3 bucket in your own
1153
1256
  # AWS account, as well as an IAM user with access key and secret that has permission
1154
1257
  # to write to that bucket.
1155
- # To configure your own S3 bucket as a storage
1156
- # backend, contact support.
1258
+ # You can configure your own S3 bucket as a
1259
+ # storage provider on the <a href="/dashboard/a/storage">Storage Providers</a> page.
1157
1260
  #
1158
1261
  # Direct downloads are not supported when
1159
1262
  # exporting data via the API.
@@ -1164,7 +1267,7 @@ class Project < Entity
1164
1267
  # save in the CSV file. If not provided, all default columns will be saved. (array of
1165
1268
  # strings, optional) </td></tr>
1166
1269
  # </table>
1167
- #
1270
+ # <br />
1168
1271
  # **`delete_contacts`**, **`delete_messages`**,
1169
1272
  # **`delete_rows`**, **`cancel_messages`**, **`retry_message_services`**: <br />
1170
1273
  # No parameters.
@@ -1579,16 +1682,15 @@ class Project < Entity
1579
1682
  #
1580
1683
  # - time_created (UNIX timestamp)
1581
1684
  # * Filter scheduled messages by time_created
1582
- # * Allowed modifiers: time_created[ne], time_created[min], time_created[max]
1685
+ # * Allowed modifiers: time_created[min], time_created[max]
1583
1686
  #
1584
1687
  # - next_time (UNIX timestamp)
1585
1688
  # * Filter scheduled messages by next_time
1586
- # * Allowed modifiers: next_time[ne], next_time[min], next_time[max],
1587
- # next_time[exists]
1689
+ # * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
1588
1690
  #
1589
1691
  # - sort
1590
1692
  # * Sort the results based on a field
1591
- # * Allowed values: default, name
1693
+ # * Allowed values: default, next_time
1592
1694
  # * Default: default
1593
1695
  #
1594
1696
  # - sort_dir
@@ -1880,6 +1982,195 @@ class Project < Entity
1880
1982
  return AirtimeTransaction.new(@api, {'project_id' => self.id, 'id' => id}, false)
1881
1983
  end
1882
1984
 
1985
+ #
1986
+ # Gets a list of all custom fields defined for contacts in this project. The return value is
1987
+ # an array of objects with the properties 'name', 'variable', 'type', 'order', 'readonly', and
1988
+ # 'lookup_key'. (Fields are automatically created any time a Contact's 'vars' property is
1989
+ # updated.)
1990
+ #
1991
+ # Returns:
1992
+ # array
1993
+ #
1994
+ def get_contact_fields()
1995
+ return @api.do_request("GET", get_base_api_path() + "/contact_fields")
1996
+ end
1997
+
1998
+ #
1999
+ # Allows customizing how a custom contact field is displayed in the Telerivet web app.
2000
+ #
2001
+ # Arguments:
2002
+ # - variable
2003
+ # * The variable name of the field to create or update.
2004
+ # * Required
2005
+ #
2006
+ # - options (Hash)
2007
+ # * Required
2008
+ #
2009
+ # - name (string, max 64 characters)
2010
+ # * Display name for the field
2011
+ #
2012
+ # - type (int)
2013
+ # * Field type
2014
+ # * Allowed values: text, long_text, phone_number, email, url, audio, date, date_time,
2015
+ # number, boolean, select
2016
+ #
2017
+ # - order (int)
2018
+ # * Order in which to display the field
2019
+ #
2020
+ # - items (array)
2021
+ # * Array of up to 100 objects containing `value` and `label` string properties to
2022
+ # show in the dropdown list when type is `select`. Each `value` and `label` must be
2023
+ # between 1 and 256 characters in length.
2024
+ # * Required if type is `select`
2025
+ #
2026
+ # - readonly (bool)
2027
+ # * Set to true to prevent editing the field in the Telerivet web app
2028
+ #
2029
+ # - lookup_key (bool)
2030
+ # * Set to true to allow using this field as a lookup key when importing contacts via
2031
+ # the Telerivet web app
2032
+ #
2033
+ # - show_on_conversation (bool)
2034
+ # * Set to true to show field on Conversations tab
2035
+ #
2036
+ # Returns:
2037
+ # object
2038
+ #
2039
+ def set_contact_field_metadata(variable, options)
2040
+ return @api.do_request("POST", get_base_api_path() + "/contact_fields/#{variable}", options)
2041
+ end
2042
+
2043
+ #
2044
+ # Gets a list of all custom fields defined for messages in this project. The return value is
2045
+ # an array of objects with the properties 'name', 'variable', 'type', 'order', 'readonly', and
2046
+ # 'lookup_key'. (Fields are automatically created any time a Contact's 'vars' property is
2047
+ # updated.)
2048
+ #
2049
+ # Returns:
2050
+ # array
2051
+ #
2052
+ def get_message_fields()
2053
+ return @api.do_request("GET", get_base_api_path() + "/message_fields")
2054
+ end
2055
+
2056
+ #
2057
+ # Allows customizing how a custom message field is displayed in the Telerivet web app.
2058
+ #
2059
+ # Arguments:
2060
+ # - variable
2061
+ # * The variable name of the field to create or update.
2062
+ # * Required
2063
+ #
2064
+ # - options (Hash)
2065
+ # * Required
2066
+ #
2067
+ # - name (string, max 64 characters)
2068
+ # * Display name for the field
2069
+ #
2070
+ # - type (string)
2071
+ # * Field type
2072
+ # * Allowed values: text, long_text, phone_number, email, url, audio, date, date_time,
2073
+ # number, boolean, select
2074
+ #
2075
+ # - order (int)
2076
+ # * Order in which to display the field
2077
+ #
2078
+ # - items (array)
2079
+ # * Array of up to 100 objects containing `value` and `label` string properties to
2080
+ # show in the dropdown list when type is `select`. Each `value` and `label` must be
2081
+ # between 1 and 256 characters in length.
2082
+ # * Required if type is `select`
2083
+ #
2084
+ # - hide_values (bool)
2085
+ # * Set to true to avoid showing values of this field on the Messages page
2086
+ #
2087
+ # Returns:
2088
+ # object
2089
+ #
2090
+ def set_message_field_metadata(variable, options)
2091
+ return @api.do_request("POST", get_base_api_path() + "/message_fields/#{variable}", options)
2092
+ end
2093
+
2094
+ #
2095
+ # Retrieves statistics about messages sent or received via Telerivet. This endpoint returns
2096
+ # historical data that is computed shortly after midnight each day in the project's time zone,
2097
+ # and does not contain message statistics for the current day.
2098
+ #
2099
+ # Arguments:
2100
+ # - options (Hash)
2101
+ # * Required
2102
+ #
2103
+ # - start_date (string)
2104
+ # * Start date of message statistics, in YYYY-MM-DD format
2105
+ # * Required
2106
+ #
2107
+ # - end_date (string)
2108
+ # * End date of message statistics (inclusive), in YYYY-MM-DD format
2109
+ # * Required
2110
+ #
2111
+ # - rollup (string)
2112
+ # * Date interval to group by
2113
+ # * Allowed values: day, week, month, year, all
2114
+ # * Default: day
2115
+ #
2116
+ # - properties (string)
2117
+ # * Comma separated list of properties to group by
2118
+ # * Allowed values: org_id, org_name, org_industry, project_id, project_name, user_id,
2119
+ # user_email, user_name, phone_id, phone_name, phone_type, direction, source, status,
2120
+ # network_code, network_name, message_type, service_id, service_name, simulated, link
2121
+ #
2122
+ # - metrics (string)
2123
+ # * Comma separated list of metrics to return (summed for each distinct value of the
2124
+ # requested properties)
2125
+ # * Allowed values: count, num_parts, duration, price
2126
+ # * Required
2127
+ #
2128
+ # - currency (string)
2129
+ # * Three-letter ISO 4217 currency code used when returning the 'price' field. If the
2130
+ # original price was in a different currency, it will be converted to the requested
2131
+ # currency using the approximate current exchange rate.
2132
+ # * Default: USD
2133
+ #
2134
+ # - filters (Hash)
2135
+ # * Key-value pairs of properties and corresponding values; the returned statistics
2136
+ # will only include messages where the property matches the provided value. Only the
2137
+ # following properties are supported for filters: `user_id`, `phone_id`, `direction`,
2138
+ # `source`, `status`, `service_id`, `simulated`, `message_type`, `network_code`
2139
+ #
2140
+ # Returns:
2141
+ # (associative array)
2142
+ # - intervals (array)
2143
+ # * List of objects representing each date interval containing at least one message
2144
+ # matching the filters.
2145
+ # Each object has the following properties:
2146
+ #
2147
+ # <table>
2148
+ # <tr><td> start_time </td> <td> The UNIX timestamp of the start
2149
+ # of the interval (int) </td></tr>
2150
+ # <tr><td> end_time </td> <td> The UNIX timestamp of the end of
2151
+ # the interval, exclusive (int) </td></tr>
2152
+ # <tr><td> start_date </td> <td> The date of the start of the
2153
+ # interval in YYYY-MM-DD format (string) </td></tr>
2154
+ # <tr><td> end_date </td> <td> The date of the end of the
2155
+ # interval in YYYY-MM-DD format, inclusive (string) </td></tr>
2156
+ # <tr><td> groups </td> <td> Array of groups for each
2157
+ # combination of requested property values matching the filters (array)
2158
+ # <br /><br />
2159
+ # Each object has the following properties:
2160
+ # <table>
2161
+ # <tr><td> properties </td> <td> An object of key/value
2162
+ # pairs for each distinct value of the requested properties (object) </td></tr>
2163
+ # <tr><td> metrics </td> <td> An object of key/value pairs
2164
+ # for each requested metric (object) </td></tr>
2165
+ # </table>
2166
+ # </td></tr>
2167
+ # </table>
2168
+ #
2169
+ def get_message_stats(options)
2170
+ data = @api.do_request("GET", get_base_api_path() + "/message_stats", options)
2171
+ return data
2172
+ end
2173
+
1883
2174
  #
1884
2175
  # Saves any fields or custom variables that have changed for the project.
1885
2176
  #
@@ -135,6 +135,13 @@ module Telerivet
135
135
  # temporary and may not be valid for more than 1 day.
136
136
  # * Read-only
137
137
  #
138
+ # - 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
144
+ #
138
145
  # - vars (Hash)
139
146
  # * Custom variables stored for this scheduled message (copied to Message when sent)
140
147
  # * Updatable via API
@@ -258,6 +265,10 @@ class ScheduledMessage < Entity
258
265
  get('media')
259
266
  end
260
267
 
268
+ def route_params
269
+ get('route_params')
270
+ end
271
+
261
272
  def label_ids
262
273
  get('label_ids')
263
274
  end
@@ -117,6 +117,15 @@ class Service < Entity
117
117
  # or `phone_number` is required if `context` is 'contact'). If no contact exists with
118
118
  # this phone number, a new contact will be created.
119
119
  #
120
+ # - variables (Hash)
121
+ # * Object containing up to 25 temporary variable names and their corresponding values
122
+ # to set when invoking the service. Values may be strings, numbers, or boolean
123
+ # (true/false). String values may be up to 4096 bytes in length. Arrays and objects
124
+ # are not supported. Within Custom Actions, each variable can be used like `[[$name]]`
125
+ # (with a leading `$` character and surrounded by double square brackets). Within a
126
+ # Cloud Script API service or JavaScript action, each variable will be available as a
127
+ # global JavaScript variable like `$name` (with a leading `$` character).
128
+ #
120
129
  # - route_id
121
130
  # * The ID of the phone or route that the service will use for sending messages by
122
131
  # default
data/lib/telerivet.rb CHANGED
@@ -9,7 +9,7 @@ module Telerivet
9
9
  class API
10
10
  attr_reader :num_requests
11
11
 
12
- @@client_version = '1.5.0'
12
+ @@client_version = '1.6.1'
13
13
 
14
14
  #
15
15
  # Initializes a client handle to the Telerivet REST API.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telerivet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Young
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-27 00:00:00.000000000 Z
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby client library for Telerivet REST API
14
14
  email: support@telerivet.com