telerivet 1.8.2 → 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 +4 -4
- data/lib/telerivet/airtimetransaction.rb +4 -1
- data/lib/telerivet/broadcast.rb +30 -6
- data/lib/telerivet/campaign.rb +481 -0
- data/lib/telerivet/contact.rb +20 -1
- data/lib/telerivet/contactservicestate.rb +4 -2
- data/lib/telerivet/datatable.rb +183 -9
- data/lib/telerivet/dataview.rb +132 -0
- data/lib/telerivet/entity.rb +3 -3
- data/lib/telerivet/group.rb +32 -0
- data/lib/telerivet/label.rb +1 -1
- data/lib/telerivet/message.rb +28 -6
- data/lib/telerivet/messagetemplate.rb +197 -0
- data/lib/telerivet/organization.rb +310 -43
- data/lib/telerivet/phone.rb +213 -1
- data/lib/telerivet/project.rb +1376 -182
- data/lib/telerivet/relativescheduledmessage.rb +11 -10
- data/lib/telerivet/route.rb +22 -4
- data/lib/telerivet/scheduledmessage.rb +16 -6
- data/lib/telerivet/scheduledservice.rb +160 -0
- data/lib/telerivet/service.rb +91 -5
- data/lib/telerivet/storedfile.rb +167 -0
- data/lib/telerivet/task.rb +8 -0
- data/lib/telerivet/webhook.rb +98 -0
- data/lib/telerivet.rb +1 -1
- metadata +8 -2
data/lib/telerivet/datatable.rb
CHANGED
|
@@ -51,6 +51,10 @@ module Telerivet
|
|
|
51
51
|
# - project_id
|
|
52
52
|
# * ID of the project this data table belongs to
|
|
53
53
|
# * Read-only
|
|
54
|
+
#
|
|
55
|
+
# - url
|
|
56
|
+
# * URL to this data table in the Telerivet web app
|
|
57
|
+
# * Read-only
|
|
54
58
|
#
|
|
55
59
|
class DataTable < Entity
|
|
56
60
|
#
|
|
@@ -126,36 +130,177 @@ class DataTable < Entity
|
|
|
126
130
|
DataRow.new(@api, @api.do_request("POST", get_base_api_path() + "/rows", options))
|
|
127
131
|
end
|
|
128
132
|
|
|
133
|
+
#
|
|
134
|
+
# Creates and/or updates up to 200 rows in a single API call. When creating or updating a
|
|
135
|
+
# large number of rows, this method is significantly faster than sending a separate API
|
|
136
|
+
# request for each row.
|
|
137
|
+
#
|
|
138
|
+
# By default, a new row will be created for each item. To update
|
|
139
|
+
# existing rows, set the `lookup_key` parameter to match rows by ID, contact, or the value of
|
|
140
|
+
# a custom variable.
|
|
141
|
+
#
|
|
142
|
+
# Arguments:
|
|
143
|
+
# - options (Hash)
|
|
144
|
+
# * Required
|
|
145
|
+
#
|
|
146
|
+
# - rows (array)
|
|
147
|
+
# * Array of up to 200 objects which may contain the properties `vars` (object),
|
|
148
|
+
# `contact_id` (string), `from_number` (string), and `id` (string). All properties are
|
|
149
|
+
# optional, unless used as a lookup key.
|
|
150
|
+
# * Required
|
|
151
|
+
#
|
|
152
|
+
# - lookup_key
|
|
153
|
+
# * The field used to search for a matching row, or 'none' to always create a new row.
|
|
154
|
+
# To search by a custom variable, precede the variable name with 'vars.'.
|
|
155
|
+
# * Allowed values: none, id, contact_id, vars.variable_name
|
|
156
|
+
# * Default: none
|
|
157
|
+
#
|
|
158
|
+
# Returns:
|
|
159
|
+
# (associative array)
|
|
160
|
+
# - rows (array)
|
|
161
|
+
# * List of objects representing each row, in the same order as provided in the
|
|
162
|
+
# `rows` parameter in the API request.
|
|
163
|
+
#
|
|
164
|
+
def import_rows(options)
|
|
165
|
+
data = @api.do_request("POST", get_base_api_path() + "/import_rows", options)
|
|
166
|
+
return data
|
|
167
|
+
end
|
|
168
|
+
|
|
129
169
|
#
|
|
130
170
|
# Retrieves the row in the given table with the given ID.
|
|
131
171
|
#
|
|
132
172
|
# Arguments:
|
|
133
|
-
# -
|
|
173
|
+
# - row_id
|
|
134
174
|
# * ID of the row
|
|
135
175
|
# * Required
|
|
136
176
|
#
|
|
137
177
|
# Returns:
|
|
138
178
|
# Telerivet::DataRow
|
|
139
179
|
#
|
|
140
|
-
def get_row_by_id(
|
|
180
|
+
def get_row_by_id(row_id)
|
|
141
181
|
require_relative 'datarow'
|
|
142
|
-
DataRow.new(@api, @api.do_request("GET", get_base_api_path() + "/rows/#{
|
|
182
|
+
DataRow.new(@api, @api.do_request("GET", get_base_api_path() + "/rows/#{row_id}"))
|
|
143
183
|
end
|
|
144
184
|
|
|
145
185
|
#
|
|
146
186
|
# Initializes the row in the given table with the given ID, without making an API request.
|
|
147
187
|
#
|
|
148
188
|
# Arguments:
|
|
149
|
-
# -
|
|
189
|
+
# - row_id
|
|
150
190
|
# * ID of the row
|
|
151
191
|
# * Required
|
|
152
192
|
#
|
|
153
193
|
# Returns:
|
|
154
194
|
# Telerivet::DataRow
|
|
155
195
|
#
|
|
156
|
-
def init_row_by_id(
|
|
196
|
+
def init_row_by_id(row_id)
|
|
157
197
|
require_relative 'datarow'
|
|
158
|
-
return DataRow.new(@api, {'project_id' => self.project_id, 'table_id' => self.id, '
|
|
198
|
+
return DataRow.new(@api, {'project_id' => self.project_id, 'table_id' => self.id, 'row_id' => row_id}, false)
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
#
|
|
202
|
+
# Queries views of this data table.
|
|
203
|
+
#
|
|
204
|
+
# Arguments:
|
|
205
|
+
# - options (Hash)
|
|
206
|
+
#
|
|
207
|
+
# - name
|
|
208
|
+
# * Filter views by name
|
|
209
|
+
# * Allowed modifiers: name[ne], name[prefix], name[not_prefix], name[gte], name[gt],
|
|
210
|
+
# name[lt], name[lte]
|
|
211
|
+
#
|
|
212
|
+
# - sort
|
|
213
|
+
# * Sort the results based on a field
|
|
214
|
+
# * Allowed values: default, name
|
|
215
|
+
# * Default: default
|
|
216
|
+
#
|
|
217
|
+
# - sort_dir
|
|
218
|
+
# * Sort the results in ascending or descending order
|
|
219
|
+
# * Allowed values: asc, desc
|
|
220
|
+
# * Default: asc
|
|
221
|
+
#
|
|
222
|
+
# - page_size (int)
|
|
223
|
+
# * Number of results returned per page (max 500)
|
|
224
|
+
# * Default: 50
|
|
225
|
+
#
|
|
226
|
+
# - offset (int)
|
|
227
|
+
# * Number of items to skip from beginning of result set
|
|
228
|
+
# * Default: 0
|
|
229
|
+
#
|
|
230
|
+
# Returns:
|
|
231
|
+
# Telerivet::APICursor (of Telerivet::DataView)
|
|
232
|
+
#
|
|
233
|
+
def query_views(options = nil)
|
|
234
|
+
require_relative 'dataview'
|
|
235
|
+
@api.cursor(DataView, get_base_api_path() + "/views", options)
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
#
|
|
239
|
+
# Creates a new view of this data table, defined by a filter on its rows. The view's filter
|
|
240
|
+
# conditions cannot be changed after the view is created (although the view can be renamed or
|
|
241
|
+
# deleted).
|
|
242
|
+
#
|
|
243
|
+
# Telerivet will automatically store the count of rows matching each
|
|
244
|
+
# data view once a day, making it possible to retrieve historical statistics for the number of
|
|
245
|
+
# rows matching the filter, but only for dates after the view is created.
|
|
246
|
+
#
|
|
247
|
+
# Arguments:
|
|
248
|
+
# - options (Hash)
|
|
249
|
+
# * Required
|
|
250
|
+
#
|
|
251
|
+
# - name (string, max 64 characters)
|
|
252
|
+
# * Name of the view (must be unique within the data table)
|
|
253
|
+
# * Required
|
|
254
|
+
#
|
|
255
|
+
# - filters (Hash)
|
|
256
|
+
# * Key-value pairs of conditions that rows must match to be included in the view. To
|
|
257
|
+
# filter by a custom variable, precede the variable name with 'vars.' (conditions on
|
|
258
|
+
# custom variables may also be provided as a nested object under a `vars` key, e.g.
|
|
259
|
+
# `{"vars": {"q1": "yes"}}`); other supported keys are `id`, `time_created`,
|
|
260
|
+
# `time_updated`, `contact_id`, `contact_name`, and `from_number`. Each value is
|
|
261
|
+
# either a value to match exactly, or an object with an operator such as `ne`,
|
|
262
|
+
# `prefix`, `gte`, `gt`, `lte`, `lt`, `exists`, or `not_exists` as the key (e.g.
|
|
263
|
+
# `{"gte": 10}`).
|
|
264
|
+
# * Required
|
|
265
|
+
#
|
|
266
|
+
# Returns:
|
|
267
|
+
# Telerivet::DataView
|
|
268
|
+
#
|
|
269
|
+
def create_view(options)
|
|
270
|
+
require_relative 'dataview'
|
|
271
|
+
DataView.new(@api, @api.do_request("POST", get_base_api_path() + "/views", options))
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
#
|
|
275
|
+
# Retrieves the view of the given table with the given ID.
|
|
276
|
+
#
|
|
277
|
+
# Arguments:
|
|
278
|
+
# - view_id
|
|
279
|
+
# * ID of the view
|
|
280
|
+
# * Required
|
|
281
|
+
#
|
|
282
|
+
# Returns:
|
|
283
|
+
# Telerivet::DataView
|
|
284
|
+
#
|
|
285
|
+
def get_view_by_id(view_id)
|
|
286
|
+
require_relative 'dataview'
|
|
287
|
+
DataView.new(@api, @api.do_request("GET", get_base_api_path() + "/views/#{view_id}"))
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
#
|
|
291
|
+
# Initializes the view of the given table with the given ID, without making an API request.
|
|
292
|
+
#
|
|
293
|
+
# Arguments:
|
|
294
|
+
# - view_id
|
|
295
|
+
# * ID of the view
|
|
296
|
+
# * Required
|
|
297
|
+
#
|
|
298
|
+
# Returns:
|
|
299
|
+
# Telerivet::DataView
|
|
300
|
+
#
|
|
301
|
+
def init_view_by_id(view_id)
|
|
302
|
+
require_relative 'dataview'
|
|
303
|
+
return DataView.new(@api, {'project_id' => self.project_id, 'table_id' => self.id, 'view_id' => view_id}, false)
|
|
159
304
|
end
|
|
160
305
|
|
|
161
306
|
#
|
|
@@ -198,9 +343,9 @@ class DataTable < Entity
|
|
|
198
343
|
#
|
|
199
344
|
# - items (array)
|
|
200
345
|
# * Array of up to 100 objects containing `value` and `label` string properties to
|
|
201
|
-
# show
|
|
202
|
-
#
|
|
203
|
-
# * Required if type is `select`
|
|
346
|
+
# show when type is `select` or `radio`. Each `value` and `label` must be between 1
|
|
347
|
+
# and 256 characters in length.
|
|
348
|
+
# * Required if type is `select` or `radio`
|
|
204
349
|
#
|
|
205
350
|
# - readonly (bool)
|
|
206
351
|
# * Set to true to prevent editing the field in the Telerivet web app
|
|
@@ -216,6 +361,31 @@ class DataTable < Entity
|
|
|
216
361
|
return @api.do_request("POST", get_base_api_path() + "/fields/#{variable}", options)
|
|
217
362
|
end
|
|
218
363
|
|
|
364
|
+
#
|
|
365
|
+
# Updates metadata for one or more fields (columns) in the data table. Only the specified
|
|
366
|
+
# fields are updated; other fields are not affected.
|
|
367
|
+
#
|
|
368
|
+
# To delete a field, include an object with the `variable` and
|
|
369
|
+
# `delete` properties set (e.g. `{"variable": "my_field", "delete": true}`). Deleting a field
|
|
370
|
+
# will also clear the corresponding variable on all rows in the table.
|
|
371
|
+
#
|
|
372
|
+
# Arguments:
|
|
373
|
+
# - options (Hash)
|
|
374
|
+
# * Required
|
|
375
|
+
#
|
|
376
|
+
# - metadata (array)
|
|
377
|
+
# * Array of up to 100 objects describing the fields to create, update, or delete.
|
|
378
|
+
# Each object must contain a `variable` property. Only the properties provided for
|
|
379
|
+
# each field will be updated.
|
|
380
|
+
# * Required
|
|
381
|
+
#
|
|
382
|
+
# Returns:
|
|
383
|
+
# array
|
|
384
|
+
#
|
|
385
|
+
def update_fields(options)
|
|
386
|
+
return @api.do_request("POST", get_base_api_path() + "/fields", options)
|
|
387
|
+
end
|
|
388
|
+
|
|
219
389
|
#
|
|
220
390
|
# Returns the number of rows for each value of a given variable. This can be used to get the
|
|
221
391
|
# total number of responses for each choice in a poll, without making a separate query for
|
|
@@ -292,6 +462,10 @@ class DataTable < Entity
|
|
|
292
462
|
get('project_id')
|
|
293
463
|
end
|
|
294
464
|
|
|
465
|
+
def url
|
|
466
|
+
get('url')
|
|
467
|
+
end
|
|
468
|
+
|
|
295
469
|
def get_base_api_path()
|
|
296
470
|
"/projects/#{get('project_id')}/tables/#{get('id')}"
|
|
297
471
|
end
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
|
|
2
|
+
module Telerivet
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# Represents a view of a data table, defined by a saved filter on the table's rows.
|
|
6
|
+
#
|
|
7
|
+
# The view's filter conditions cannot be changed after the view is created
|
|
8
|
+
# (although the view can be renamed or deleted).
|
|
9
|
+
#
|
|
10
|
+
# Telerivet will automatically store the count of rows matching each data view
|
|
11
|
+
# once a day, making it possible to retrieve historical statistics for the number of rows
|
|
12
|
+
# matching the filter.
|
|
13
|
+
#
|
|
14
|
+
# Fields:
|
|
15
|
+
#
|
|
16
|
+
# - id (string, max 34 characters)
|
|
17
|
+
# * ID of the data view
|
|
18
|
+
# * Read-only
|
|
19
|
+
#
|
|
20
|
+
# - name
|
|
21
|
+
# * Name of the data view
|
|
22
|
+
# * Updatable via API
|
|
23
|
+
#
|
|
24
|
+
# - num_rows (int)
|
|
25
|
+
# * Number of rows matching the view filter. For performance reasons, this number may
|
|
26
|
+
# sometimes be out-of-date.
|
|
27
|
+
# * Read-only
|
|
28
|
+
#
|
|
29
|
+
# - filters (Hash)
|
|
30
|
+
# * Key-value pairs of conditions that rows must match to be included in the view, in
|
|
31
|
+
# the same format as the `filters` parameter of
|
|
32
|
+
# [table.createView](#DataTable.createView)
|
|
33
|
+
# * Read-only
|
|
34
|
+
#
|
|
35
|
+
# - table_id
|
|
36
|
+
# * ID of the table this view belongs to
|
|
37
|
+
# * Read-only
|
|
38
|
+
#
|
|
39
|
+
# - project_id
|
|
40
|
+
# * ID of the project this view belongs to
|
|
41
|
+
# * Read-only
|
|
42
|
+
#
|
|
43
|
+
# - url
|
|
44
|
+
# * URL to this view in the Telerivet web app
|
|
45
|
+
# * Read-only
|
|
46
|
+
#
|
|
47
|
+
class DataView < Entity
|
|
48
|
+
#
|
|
49
|
+
# Queries rows matching this view's filter conditions.
|
|
50
|
+
#
|
|
51
|
+
# Arguments:
|
|
52
|
+
# - options (Hash)
|
|
53
|
+
#
|
|
54
|
+
# - sort
|
|
55
|
+
# * Sort the results based on a field
|
|
56
|
+
# * Allowed values: default
|
|
57
|
+
# * Default: default
|
|
58
|
+
#
|
|
59
|
+
# - sort_dir
|
|
60
|
+
# * Sort the results in ascending or descending order
|
|
61
|
+
# * Allowed values: asc, desc
|
|
62
|
+
# * Default: asc
|
|
63
|
+
#
|
|
64
|
+
# - page_size (int)
|
|
65
|
+
# * Number of results returned per page (max 500)
|
|
66
|
+
# * Default: 50
|
|
67
|
+
#
|
|
68
|
+
# - offset (int)
|
|
69
|
+
# * Number of items to skip from beginning of result set
|
|
70
|
+
# * Default: 0
|
|
71
|
+
#
|
|
72
|
+
# Returns:
|
|
73
|
+
# Telerivet::APICursor (of Telerivet::DataRow)
|
|
74
|
+
#
|
|
75
|
+
def query_rows(options = nil)
|
|
76
|
+
require_relative 'datarow'
|
|
77
|
+
@api.cursor(DataRow, get_base_api_path() + "/rows", options)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
#
|
|
81
|
+
# Saves any fields that have changed for this view.
|
|
82
|
+
#
|
|
83
|
+
def save()
|
|
84
|
+
super
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
#
|
|
88
|
+
# Permanently deletes the given view of a data table (does not delete any rows in the table)
|
|
89
|
+
#
|
|
90
|
+
def delete()
|
|
91
|
+
@api.do_request("DELETE", get_base_api_path())
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def id
|
|
95
|
+
get('id')
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def name
|
|
99
|
+
get('name')
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def name=(value)
|
|
103
|
+
set('name', value)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def num_rows
|
|
107
|
+
get('num_rows')
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def filters
|
|
111
|
+
get('filters')
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def table_id
|
|
115
|
+
get('table_id')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def project_id
|
|
119
|
+
get('project_id')
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def url
|
|
123
|
+
get('url')
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def get_base_api_path()
|
|
127
|
+
"/projects/#{get('project_id')}/tables/#{get('table_id')}/views/#{get('id')}"
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
end
|
data/lib/telerivet/entity.rb
CHANGED
|
@@ -51,17 +51,17 @@ class Entity
|
|
|
51
51
|
@dirty[name] = value
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
def save()
|
|
54
|
+
def save()
|
|
55
55
|
dirty_props = @dirty
|
|
56
56
|
|
|
57
57
|
if @vars != nil
|
|
58
58
|
dirty_vars = @vars.get_dirty_variables()
|
|
59
59
|
@dirty['vars'] = dirty_vars if dirty_vars.length() > 0
|
|
60
60
|
end
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
@api.do_request('POST', get_base_api_path(), @dirty)
|
|
63
63
|
@dirty = {}
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
@vars.clear_dirty_variables() if @vars != nil
|
|
66
66
|
end
|
|
67
67
|
|
data/lib/telerivet/group.rb
CHANGED
|
@@ -18,6 +18,22 @@ module Telerivet
|
|
|
18
18
|
# * Whether this is a dynamic or normal group
|
|
19
19
|
# * Read-only
|
|
20
20
|
#
|
|
21
|
+
# - filters (Hash)
|
|
22
|
+
# * Key-value pairs of conditions that contacts must match to be members of a dynamic
|
|
23
|
+
# group. To filter by a custom variable, precede the variable name with 'vars.'
|
|
24
|
+
# (conditions on custom variables may also be provided as a nested object under a `vars`
|
|
25
|
+
# key, e.g. `{"vars": {"city": "Manila"}}`); other supported keys are `id`, `name`,
|
|
26
|
+
# `phone_number`, `time_created`, `time_updated`, `incoming_message_count`,
|
|
27
|
+
# `outgoing_message_count`, `last_incoming_message_time`, `last_outgoing_message_time`,
|
|
28
|
+
# `conversation_status`, `send_blocked`, `group` (ID of a normal group whose members
|
|
29
|
+
# should be included), `not_group` (ID of a normal group whose members should be
|
|
30
|
+
# excluded), and `q` (full-text search query matching contacts like the search box in
|
|
31
|
+
# the web app). Each value is either a value to match exactly, or an object with an
|
|
32
|
+
# operator such as `ne`, `prefix`, `gte`, `lt`, `exists`, or `not_exists` as the key
|
|
33
|
+
# (e.g. `{"gte": 10}`). Null if this is a normal group. Filter conditions can only be
|
|
34
|
+
# updated on dynamic groups.
|
|
35
|
+
# * Updatable via API
|
|
36
|
+
#
|
|
21
37
|
# - num_members (int)
|
|
22
38
|
# * Number of contacts in the group (null if the group is dynamic)
|
|
23
39
|
# * Read-only
|
|
@@ -45,6 +61,10 @@ module Telerivet
|
|
|
45
61
|
# Setting a variable to null will delete the variable.
|
|
46
62
|
# * Updatable via API
|
|
47
63
|
#
|
|
64
|
+
# - url
|
|
65
|
+
# * URL to this group in the Telerivet web app
|
|
66
|
+
# * Read-only
|
|
67
|
+
#
|
|
48
68
|
# - project_id
|
|
49
69
|
# * ID of the project this group belongs to
|
|
50
70
|
# * Read-only
|
|
@@ -208,6 +228,14 @@ class Group < Entity
|
|
|
208
228
|
get('dynamic')
|
|
209
229
|
end
|
|
210
230
|
|
|
231
|
+
def filters
|
|
232
|
+
get('filters')
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def filters=(value)
|
|
236
|
+
set('filters', value)
|
|
237
|
+
end
|
|
238
|
+
|
|
211
239
|
def num_members
|
|
212
240
|
get('num_members')
|
|
213
241
|
end
|
|
@@ -232,6 +260,10 @@ class Group < Entity
|
|
|
232
260
|
set('add_time_variable', value)
|
|
233
261
|
end
|
|
234
262
|
|
|
263
|
+
def url
|
|
264
|
+
get('url')
|
|
265
|
+
end
|
|
266
|
+
|
|
235
267
|
def project_id
|
|
236
268
|
get('project_id')
|
|
237
269
|
end
|
data/lib/telerivet/label.rb
CHANGED
data/lib/telerivet/message.rb
CHANGED
|
@@ -28,7 +28,8 @@ module Telerivet
|
|
|
28
28
|
#
|
|
29
29
|
# - source
|
|
30
30
|
# * How the message originated within Telerivet
|
|
31
|
-
# * Allowed values: phone, provider, web, api, service, webhook, scheduled, integration
|
|
31
|
+
# * Allowed values: phone, provider, web, api, service, webhook, scheduled, integration,
|
|
32
|
+
# mcp
|
|
32
33
|
# * Read-only
|
|
33
34
|
#
|
|
34
35
|
# - time_created (UNIX timestamp)
|
|
@@ -179,11 +180,8 @@ module Telerivet
|
|
|
179
180
|
# * Read-only
|
|
180
181
|
#
|
|
181
182
|
# - media (array)
|
|
182
|
-
# *
|
|
183
|
-
#
|
|
184
|
-
# Unknown properties are null. This property is undefined for messages that do not
|
|
185
|
-
# contain media files. Note: For files uploaded via the Telerivet web app, the URL is
|
|
186
|
-
# temporary and may not be valid for more than 1 day.
|
|
183
|
+
# * Array of media attachments for the text message. This property is undefined for
|
|
184
|
+
# messages that do not contain media files.
|
|
187
185
|
# * Read-only
|
|
188
186
|
#
|
|
189
187
|
# - mms_parts (array)
|
|
@@ -245,6 +243,10 @@ module Telerivet
|
|
|
245
243
|
# - project_id
|
|
246
244
|
# * ID of the project this contact belongs to
|
|
247
245
|
# * Read-only
|
|
246
|
+
#
|
|
247
|
+
# - url
|
|
248
|
+
# * URL to the message detail page in the Telerivet web app
|
|
249
|
+
# * Read-only
|
|
248
250
|
#
|
|
249
251
|
class Message < Entity
|
|
250
252
|
|
|
@@ -347,6 +349,22 @@ class Message < Entity
|
|
|
347
349
|
Message.new(@api, @api.do_request("POST", get_base_api_path() + "/cancel"))
|
|
348
350
|
end
|
|
349
351
|
|
|
352
|
+
#
|
|
353
|
+
# Sends a read receipt for this message. Currently only supported for incoming WhatsApp
|
|
354
|
+
# messages.
|
|
355
|
+
#
|
|
356
|
+
def send_read_receipt()
|
|
357
|
+
@api.do_request("POST", get_base_api_path() + "/send_read_receipt")
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
#
|
|
361
|
+
# Sends a typing indicator for this message. Currently only supported for incoming WhatsApp
|
|
362
|
+
# messages.
|
|
363
|
+
#
|
|
364
|
+
def send_typing_indicator()
|
|
365
|
+
@api.do_request("POST", get_base_api_path() + "/send_typing_indicator")
|
|
366
|
+
end
|
|
367
|
+
|
|
350
368
|
#
|
|
351
369
|
# Deletes this message.
|
|
352
370
|
#
|
|
@@ -530,6 +548,10 @@ class Message < Entity
|
|
|
530
548
|
get('project_id')
|
|
531
549
|
end
|
|
532
550
|
|
|
551
|
+
def url
|
|
552
|
+
get('url')
|
|
553
|
+
end
|
|
554
|
+
|
|
533
555
|
def get_base_api_path()
|
|
534
556
|
"/projects/#{get('project_id')}/messages/#{get('id')}"
|
|
535
557
|
end
|