telerivet 1.8.2 → 1.8.5

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: 1fdf6a88c994651145843d843db2ed193cd928ce09331876301801590c5da8e9
4
- data.tar.gz: 701d1a9aa6df996e5076f047751e23a9298ee224184de98122ed536f36b7ac44
3
+ metadata.gz: fa70ed97588b66c3d7fd0d24005b2403babaadec99e991282932c2affb0235dc
4
+ data.tar.gz: 8ba55152dbe5c5a4fe721de7c1eb4736d0c11ae67085f15c8a45d44489553184
5
5
  SHA512:
6
- metadata.gz: 6d6613041c5b320de88ca832f34449bdd0192e2bae6cae6038701e57f0ac7d9537ca999a1c9eeb440462b97dfa5137c23a4bf2e6abfbb7d82221d2a28169158a
7
- data.tar.gz: bfb351a5d130cb503cd259713670c7c0f6323558fe6f2246d1f83abc27a503c3c55133da04a5f50832736f22e33f31e77dfe0f089ebaa21183eb8626aadd2ac8
6
+ metadata.gz: ffeac3152f1a8138fd00a43887c17a67a694472f4b66631735f6c71d106d55c56280cf0170b944700ede23c4b4c84718b1eaf92e1ddec92c3922355cc5322112
7
+ data.tar.gz: 433530a39c90af7ac38e49f093e3a77e91c11777987b4bc0de1b8fd4b013bb798e1d02d8a2a3332a3fc87b34c048680090714f6b2a90ba63bfd440f0ed4d9918
@@ -39,6 +39,8 @@ module Telerivet
39
39
  # - status
40
40
  # * Current status of airtime transaction (`successful`, `failed`, `cancelled`,
41
41
  # `queued`, `processing`, `submitted`, `pending_approval`, or `pending_payment`)
42
+ # * Allowed values: successful, failed, cancelled, queued, processing, submitted,
43
+ # pending_approval, pending_payment
42
44
  # * Read-only
43
45
  #
44
46
  # - status_text
@@ -199,6 +199,16 @@ module Telerivet
199
199
  # - project_id
200
200
  # * ID of the project this broadcast belongs to
201
201
  # * Read-only
202
+ #
203
+ # - is_template (bool)
204
+ # * Set to true if Telerivet will render variables like [[contact.name]] in the message
205
+ # content
206
+ # * Read-only
207
+ #
208
+ # - recipients_str (string)
209
+ # * A string with a human readable description of the first few recipients (possibly
210
+ # truncated)
211
+ # * Read-only
202
212
  #
203
213
  class Broadcast < Entity
204
214
  #
@@ -343,6 +353,14 @@ class Broadcast < Entity
343
353
  get('project_id')
344
354
  end
345
355
 
356
+ def is_template
357
+ get('is_template')
358
+ end
359
+
360
+ def recipients_str
361
+ get('recipients_str')
362
+ end
363
+
346
364
  def get_base_api_path()
347
365
  "/projects/#{get('project_id')}/broadcasts/#{get('id')}"
348
366
  end
@@ -130,32 +130,32 @@ class DataTable < Entity
130
130
  # Retrieves the row in the given table with the given ID.
131
131
  #
132
132
  # Arguments:
133
- # - id
133
+ # - row_id
134
134
  # * ID of the row
135
135
  # * Required
136
136
  #
137
137
  # Returns:
138
138
  # Telerivet::DataRow
139
139
  #
140
- def get_row_by_id(id)
140
+ def get_row_by_id(row_id)
141
141
  require_relative 'datarow'
142
- DataRow.new(@api, @api.do_request("GET", get_base_api_path() + "/rows/#{id}"))
142
+ DataRow.new(@api, @api.do_request("GET", get_base_api_path() + "/rows/#{row_id}"))
143
143
  end
144
144
 
145
145
  #
146
146
  # Initializes the row in the given table with the given ID, without making an API request.
147
147
  #
148
148
  # Arguments:
149
- # - id
149
+ # - row_id
150
150
  # * ID of the row
151
151
  # * Required
152
152
  #
153
153
  # Returns:
154
154
  # Telerivet::DataRow
155
155
  #
156
- def init_row_by_id(id)
156
+ def init_row_by_id(row_id)
157
157
  require_relative 'datarow'
158
- return DataRow.new(@api, {'project_id' => self.project_id, 'table_id' => self.id, 'id' => id}, false)
158
+ return DataRow.new(@api, {'project_id' => self.project_id, 'table_id' => self.id, 'row_id' => row_id}, false)
159
159
  end
160
160
 
161
161
  #
@@ -198,9 +198,9 @@ class DataTable < Entity
198
198
  #
199
199
  # - items (array)
200
200
  # * Array of up to 100 objects containing `value` and `label` string properties to
201
- # show in the dropdown list when type is `select`. Each `value` and `label` must be
202
- # between 1 and 256 characters in length.
203
- # * Required if type is `select`
201
+ # show when type is `select` or `radio`. Each `value` and `label` must be between 1
202
+ # and 256 characters in length.
203
+ # * Required if type is `select` or `radio`
204
204
  #
205
205
  # - readonly (bool)
206
206
  # * Set to true to prevent editing the field in the Telerivet web app
@@ -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
 
@@ -0,0 +1,197 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents a reusable message template that can be used when composing or scheduling
6
+ # messages.
7
+ #
8
+ # Message templates can include placeholder variables using double square
9
+ # brackets (e.g. `[[contact.name]]`) that are replaced with actual values when the message is
10
+ # sent. For available variables, see [Variable Reference](#variables). The double square
11
+ # brackets may also include [filters](/api/rules_engine#filters) to transform variables, such
12
+ # as to set a default value.
13
+ #
14
+ # Templates synchronized from a WhatsApp Business Account are read-only and
15
+ # cannot be modified or deleted via the API.
16
+ # (When using Telerivet to send messages via a WhatsApp route, Telerivet tries
17
+ # to match the content of each outgoing message to one of these WhatsApp message templates. If
18
+ # a template matches, Telerivet sends a WhatsApp template message instead of a session
19
+ # message.)
20
+ #
21
+ # Fields:
22
+ #
23
+ # - id (string, max 34 characters)
24
+ # * ID of the message template
25
+ # * Read-only
26
+ #
27
+ # - name (string)
28
+ # * Name of the template (max 127 characters)
29
+ # * Updatable via API
30
+ #
31
+ # - content (string)
32
+ # * Content of the message template (max 2000 characters)
33
+ # * Updatable via API
34
+ #
35
+ # - track_clicks (bool)
36
+ # * If true, URLs in the content will be replaced with short links that track clicks
37
+ # when the template is used
38
+ # * Updatable via API
39
+ #
40
+ # - readonly (bool)
41
+ # * True if the template cannot be modified or deleted (i.e., it was synchronized from a
42
+ # WhatsApp Business Account)
43
+ # * Read-only
44
+ #
45
+ # - short_link_params (Hash)
46
+ # * Custom parameters for short links (only if track_clicks is true)
47
+ # * Updatable via API
48
+ #
49
+ # - attachments (array)
50
+ # * List of attachment objects with file URLs
51
+ # * Updatable via API
52
+ #
53
+ # - route_params (Hash)
54
+ # * Route-specific parameters to use when sending messages with this template.
55
+ #
56
+ # When sending messages via chat apps such as WhatsApp, the route_params
57
+ # parameter can be used to send messages with app-specific features such as quick
58
+ # replies and link buttons.
59
+ #
60
+ # For more details, see [Route-Specific Parameters](#route_params).
61
+ # * Updatable via API
62
+ #
63
+ # - waba_id (string)
64
+ # * ID of the WhatsApp Business Account that this template is associated with (only
65
+ # present for WhatsApp templates)
66
+ # * Read-only
67
+ #
68
+ # - whatsapp_template (Hash)
69
+ # * For templates synchronized from a WhatsApp Business Account, contains the full
70
+ # template data from WhatsApp with properties including `id`, `name`, `language`,
71
+ # `status`, `category`, and `components`. The full format is defined in the [WhatsApp
72
+ # Template API
73
+ # documentation](https://developers.facebook.com/documentation/business-messaging/whatsapp/reference/whatsapp-business-account/template-api#get-version-template-id).
74
+ # Only present for WhatsApp templates.
75
+ # * Read-only
76
+ #
77
+ # - time_created (UNIX timestamp)
78
+ # * Time the template was created in Telerivet
79
+ # * Read-only
80
+ #
81
+ # - time_updated (UNIX timestamp)
82
+ # * Time the template was last updated
83
+ # * Read-only
84
+ #
85
+ # - vars (Hash)
86
+ # * Custom variables stored for this template. Variable names may be up to 32 characters
87
+ # in length and can contain the characters a-z, A-Z, 0-9, and _.
88
+ # Values may be strings, numbers, or boolean (true/false).
89
+ # String values may be up to 4096 bytes in length when encoded as UTF-8.
90
+ # Up to 100 variables are supported per object.
91
+ # Setting a variable to null will delete the variable.
92
+ # * Updatable via API
93
+ #
94
+ # - project_id
95
+ # * ID of the project this template belongs to
96
+ # * Read-only
97
+ #
98
+ class MessageTemplate < Entity
99
+ #
100
+ # Saves any fields that have changed for the message template.
101
+ #
102
+ def save()
103
+ super
104
+ end
105
+
106
+ #
107
+ # Deletes the message template.
108
+ #
109
+ # Note: Templates synchronized from a WhatsApp Business Account cannot be deleted via the API.
110
+ #
111
+ def delete()
112
+ @api.do_request("DELETE", get_base_api_path())
113
+ end
114
+
115
+ def id
116
+ get('id')
117
+ end
118
+
119
+ def name
120
+ get('name')
121
+ end
122
+
123
+ def name=(value)
124
+ set('name', value)
125
+ end
126
+
127
+ def content
128
+ get('content')
129
+ end
130
+
131
+ def content=(value)
132
+ set('content', value)
133
+ end
134
+
135
+ def track_clicks
136
+ get('track_clicks')
137
+ end
138
+
139
+ def track_clicks=(value)
140
+ set('track_clicks', value)
141
+ end
142
+
143
+ def readonly
144
+ get('readonly')
145
+ end
146
+
147
+ def short_link_params
148
+ get('short_link_params')
149
+ end
150
+
151
+ def short_link_params=(value)
152
+ set('short_link_params', value)
153
+ end
154
+
155
+ def attachments
156
+ get('attachments')
157
+ end
158
+
159
+ def attachments=(value)
160
+ set('attachments', value)
161
+ end
162
+
163
+ def route_params
164
+ get('route_params')
165
+ end
166
+
167
+ def route_params=(value)
168
+ set('route_params', value)
169
+ end
170
+
171
+ def waba_id
172
+ get('waba_id')
173
+ end
174
+
175
+ def whatsapp_template
176
+ get('whatsapp_template')
177
+ end
178
+
179
+ def time_created
180
+ get('time_created')
181
+ end
182
+
183
+ def time_updated
184
+ get('time_updated')
185
+ end
186
+
187
+ def project_id
188
+ get('project_id')
189
+ end
190
+
191
+ def get_base_api_path()
192
+ "/projects/#{get('project_id')}/message_templates/#{get('id')}"
193
+ end
194
+
195
+ end
196
+
197
+ end
@@ -51,6 +51,17 @@ class Organization < Entity
51
51
  # contact.
52
52
  # * Default: 1
53
53
  #
54
+ # - message_retention_days (int)
55
+ # * Number of days to retain messages in this project. Messages older than this will
56
+ # be automatically deleted. If null or not provided, messages will be retained
57
+ # forever.
58
+ #
59
+ # - short_link_scheme (bool)
60
+ # * If true (the default), short links in messages will include the scheme (e.g.,
61
+ # 'https://rvt.me/xxxxxxxxx'). If false, short links will not include the scheme
62
+ # (e.g., 'rvt.me/xxxxxxxxx').
63
+ # * Default: 1
64
+ #
54
65
  # - vars
55
66
  # * Custom variables and values to set for this project
56
67
  #
@@ -131,6 +142,8 @@ class Organization < Entity
131
142
  # Arguments:
132
143
  # - usage_type
133
144
  # * Usage type.
145
+ # * Allowed values: phones, projects, users, contacts, messages_day, stored_messages,
146
+ # data_rows, api_requests_day
134
147
  # * Required
135
148
  #
136
149
  # Returns:
@@ -191,29 +204,6 @@ class Organization < Entity
191
204
  # - intervals (array)
192
205
  # * List of objects representing each date interval containing at least one message
193
206
  # matching the filters.
194
- # Each object has the following properties:
195
- #
196
- # <table>
197
- # <tr><td> start_time </td> <td> The UNIX timestamp of the start
198
- # of the interval (int) </td></tr>
199
- # <tr><td> end_time </td> <td> The UNIX timestamp of the end of
200
- # the interval, exclusive (int) </td></tr>
201
- # <tr><td> start_date </td> <td> The date of the start of the
202
- # interval in YYYY-MM-DD format (string) </td></tr>
203
- # <tr><td> end_date </td> <td> The date of the end of the
204
- # interval in YYYY-MM-DD format, inclusive (string) </td></tr>
205
- # <tr><td> groups </td> <td> Array of groups for each
206
- # combination of requested property values matching the filters (array)
207
- # <br /><br />
208
- # Each object has the following properties:
209
- # <table>
210
- # <tr><td> properties </td> <td> An object of key/value
211
- # pairs for each distinct value of the requested properties (object) </td></tr>
212
- # <tr><td> metrics </td> <td> An object of key/value pairs
213
- # for each requested metric (object) </td></tr>
214
- # </table>
215
- # </td></tr>
216
- # </table>
217
207
  #
218
208
  def get_message_stats(options)
219
209
  data = @api.do_request("GET", get_base_api_path() + "/message_stats", options)
@@ -57,6 +57,48 @@ module Telerivet
57
57
  # * ID of the project this phone belongs to
58
58
  # * Read-only
59
59
  #
60
+ # - validate_recipient_numbers (bool)
61
+ # * Set to true to check that recipient phone numbers appear to be valid before sending
62
+ # messages. Messages to invalid phone numbers will fail without being sent. Only applies
63
+ # to phones capable of sending messages.
64
+ # * Updatable via API
65
+ #
66
+ # - allowed_recipient_countries (array of strings)
67
+ # * Array of 2-letter country codes (ISO 3166-1 alpha-2) to which this phone is allowed
68
+ # to send messages. When null, there is no restriction on recipient countries.
69
+ # * Updatable via API
70
+ #
71
+ # - send_delay (number)
72
+ # * Number of seconds to wait after sending each message from this phone, to avoid
73
+ # exceeding carrier rate limits.
74
+ # * Updatable via API
75
+ #
76
+ # - timezone_id (string)
77
+ # * A string specifying the time zone that will be used when implementing quiet hours or
78
+ # estimating send times; see [List of tz database time zones Wikipedia
79
+ # article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones). When null, the
80
+ # project's default time zone is used.
81
+ # * Updatable via API
82
+ #
83
+ # - quiet_mode (string)
84
+ # * Controls behavior during quiet hours (see quiet_start/quiet_end). Possible values
85
+ # are 'off' (quiet hours disabled), 'delay' (messages are delayed until quiet hours
86
+ # end), or 'confirm' (requires manual confirmation to send during quiet hours).
87
+ # * Allowed values: off, delay, confirm
88
+ # * Updatable via API
89
+ #
90
+ # - quiet_start (string)
91
+ # * Time of day when quiet hours begin, in HH:MM format (24-hour time) in the phone's
92
+ # time zone. Messages sent during quiet hours are delayed or require confirmation
93
+ # depending on quiet_mode. Only applicable when quiet_mode is not 'off'.
94
+ # * Updatable via API
95
+ #
96
+ # - quiet_end (string)
97
+ # * Time of day when quiet hours end, in HH:MM format (24-hour time) in the phone's time
98
+ # zone. Messages sent during quiet hours are delayed or require confirmation depending
99
+ # on quiet_mode. Only applicable when quiet_mode is not 'off'.
100
+ # * Updatable via API
101
+ #
60
102
  # - battery (int)
61
103
  # * Current battery level, on a scale from 0 to 100, as of the last time the phone
62
104
  # connected to Telerivet (only present for Android phones)
@@ -104,6 +146,36 @@ module Telerivet
104
146
  # increase this limit, install additional SMS expansion packs in the Telerivet Gateway
105
147
  # app. (only present for Android phones)
106
148
  # * Read-only
149
+ #
150
+ # - external_account_id (string)
151
+ # * Account ID for the external API (e.g. Twilio Account SID, Vonage API Key). Only
152
+ # present for routes that support external API configuration. See
153
+ # [createPhone](#Project.createPhone) for the meaning of this field for each phone type.
154
+ # * Updatable via API
155
+ #
156
+ # - external_id (string)
157
+ # * External phone/resource ID within the external API account (if applicable). Only
158
+ # present for routes that support external API configuration.
159
+ # * Updatable via API
160
+ #
161
+ # - external_config (Hash)
162
+ # * Additional configuration settings specific to the phone_type. Only present for
163
+ # routes that support external API configuration. See
164
+ # [createPhone](#Project.createPhone) for available settings for each phone type.
165
+ # * Updatable via API
166
+ #
167
+ # - external_setup (Hash)
168
+ # * Configuration info for routes that require manual webhook setup. Only present for
169
+ # routes that require manual configuration of callback URLs with the external provider.
170
+ # Contains URL properties for each webhook type that needs to be configured (e.g.,
171
+ # `incoming_message_url`, `message_status_url`, `incoming_call_url`).
172
+ # * Read-only
173
+ #
174
+ # - external_secret (string)
175
+ # * Secret/API key for the external API (e.g. Twilio Auth Token, Vonage API Secret).
176
+ # Only applicable for routes that support external API configuration. Write-only; not
177
+ # returned by the API when retrieving a phone.
178
+ # * Updatable via API
107
179
  #
108
180
  class Phone < Entity
109
181
  #
@@ -243,6 +315,62 @@ class Phone < Entity
243
315
  get('project_id')
244
316
  end
245
317
 
318
+ def validate_recipient_numbers
319
+ get('validate_recipient_numbers')
320
+ end
321
+
322
+ def validate_recipient_numbers=(value)
323
+ set('validate_recipient_numbers', value)
324
+ end
325
+
326
+ def allowed_recipient_countries
327
+ get('allowed_recipient_countries')
328
+ end
329
+
330
+ def allowed_recipient_countries=(value)
331
+ set('allowed_recipient_countries', value)
332
+ end
333
+
334
+ def send_delay
335
+ get('send_delay')
336
+ end
337
+
338
+ def send_delay=(value)
339
+ set('send_delay', value)
340
+ end
341
+
342
+ def timezone_id
343
+ get('timezone_id')
344
+ end
345
+
346
+ def timezone_id=(value)
347
+ set('timezone_id', value)
348
+ end
349
+
350
+ def quiet_mode
351
+ get('quiet_mode')
352
+ end
353
+
354
+ def quiet_mode=(value)
355
+ set('quiet_mode', value)
356
+ end
357
+
358
+ def quiet_start
359
+ get('quiet_start')
360
+ end
361
+
362
+ def quiet_start=(value)
363
+ set('quiet_start', value)
364
+ end
365
+
366
+ def quiet_end
367
+ get('quiet_end')
368
+ end
369
+
370
+ def quiet_end=(value)
371
+ set('quiet_end', value)
372
+ end
373
+
246
374
  def battery
247
375
  get('battery')
248
376
  end
@@ -279,6 +407,42 @@ class Phone < Entity
279
407
  get('send_limit')
280
408
  end
281
409
 
410
+ def external_account_id
411
+ get('external_account_id')
412
+ end
413
+
414
+ def external_account_id=(value)
415
+ set('external_account_id', value)
416
+ end
417
+
418
+ def external_id
419
+ get('external_id')
420
+ end
421
+
422
+ def external_id=(value)
423
+ set('external_id', value)
424
+ end
425
+
426
+ def external_config
427
+ get('external_config')
428
+ end
429
+
430
+ def external_config=(value)
431
+ set('external_config', value)
432
+ end
433
+
434
+ def external_setup
435
+ get('external_setup')
436
+ end
437
+
438
+ def external_secret
439
+ get('external_secret')
440
+ end
441
+
442
+ def external_secret=(value)
443
+ set('external_secret', value)
444
+ end
445
+
282
446
  def get_base_api_path()
283
447
  "/projects/#{get('project_id')}/phones/#{get('id')}"
284
448
  end