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.
@@ -9,9 +9,6 @@ module Telerivet
9
9
  # parameters, and properties related to Custom Routes continue to use the term "Route" to
10
10
  # maintain backwards compatibility.
11
11
  #
12
- # Custom routing rules can currently only be configured via Telerivet's web
13
- # UI.
14
- #
15
12
  # Fields:
16
13
  #
17
14
  # - id (string, max 34 characters)
@@ -34,10 +31,15 @@ module Telerivet
34
31
  # - project_id
35
32
  # * ID of the project this route belongs to
36
33
  # * Read-only
34
+ #
35
+ # - actions (array of RoutingAction)
36
+ # * Array of routing action objects. Allowed action types: `use_phone`, `condition`.
37
+ # * Updatable via API
37
38
  #
38
39
  class Route < Entity
39
40
  #
40
- # Saves any fields or custom variables that have changed for this custom route.
41
+ # Saves any fields, custom variables, or routing actions that have changed for this custom
42
+ # route.
41
43
  #
42
44
  def save()
43
45
  super
@@ -59,6 +61,14 @@ class Route < Entity
59
61
  get('project_id')
60
62
  end
61
63
 
64
+ def actions
65
+ get('actions')
66
+ end
67
+
68
+ def actions=(value)
69
+ set('actions', value)
70
+ end
71
+
62
72
  def get_base_api_path()
63
73
  "/projects/#{get('project_id')}/routes/#{get('id')}"
64
74
  end
@@ -169,6 +169,11 @@ module Telerivet
169
169
  # - project_id
170
170
  # * ID of the project this scheduled message belongs to
171
171
  # * Read-only
172
+ #
173
+ # - is_template (bool)
174
+ # * Set to true if Telerivet will render variables like [[contact.name]] in the message
175
+ # content
176
+ # * Read-only
172
177
  #
173
178
  class ScheduledMessage < Entity
174
179
  #
@@ -365,6 +370,10 @@ class ScheduledMessage < Entity
365
370
  get('project_id')
366
371
  end
367
372
 
373
+ def is_template
374
+ get('is_template')
375
+ end
376
+
368
377
  def get_base_api_path()
369
378
  "/projects/#{get('project_id')}/scheduled/#{get('id')}"
370
379
  end
@@ -0,0 +1,160 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents a scheduled service within Telerivet.
6
+ #
7
+ # Scheduled services allow services to be triggered automatically at specified
8
+ # times.
9
+ # The ScheduledService object is only used for services that are triggered for
10
+ # a project (e.g. `scheduled_actions` or `scheduled_script`).
11
+ #
12
+ # Note: To schedule services that are triggered for a contact, the
13
+ # [ScheduledMessage](#ScheduledMessage) object should be used instead, with
14
+ # `message_type`=`service`.
15
+ #
16
+ # Fields:
17
+ #
18
+ # - id (string, max 34 characters)
19
+ # * ID of the scheduled service
20
+ # * Read-only
21
+ #
22
+ # - service_id (string, max 34 characters)
23
+ # * ID of the service to be triggered
24
+ # * Read-only
25
+ #
26
+ # - rrule
27
+ # * Recurrence rule for recurring scheduled services, e.g. 'FREQ=MONTHLY' or
28
+ # 'FREQ=WEEKLY;INTERVAL=2'; see
29
+ # [RFC2445](https://tools.ietf.org/html/rfc2445#section-4.3.10).
30
+ # * Updatable via API
31
+ #
32
+ # - timezone_id
33
+ # * Timezone ID used to compute times for recurring scheduled services; see [List of tz
34
+ # database time zones Wikipedia
35
+ # article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
36
+ # * Updatable via API
37
+ #
38
+ # - time_created (UNIX timestamp)
39
+ # * Time the scheduled service was created in Telerivet
40
+ # * Read-only
41
+ #
42
+ # - start_time (UNIX timestamp)
43
+ # * The time that the service will be triggered (or first triggered for recurring
44
+ # scheduled services)
45
+ # * Updatable via API
46
+ #
47
+ # - end_time (UNIX timestamp)
48
+ # * Time after which a recurring scheduled service will stop (not applicable to
49
+ # non-recurring scheduled services)
50
+ # * Updatable via API
51
+ #
52
+ # - prev_time (UNIX timestamp)
53
+ # * The most recent time that Telerivet triggered this scheduled service (null if it has
54
+ # never been triggered)
55
+ # * Read-only
56
+ #
57
+ # - next_time (UNIX timestamp)
58
+ # * The next upcoming time that Telerivet will trigger this scheduled service (null if
59
+ # it will not be triggered again)
60
+ # * Read-only
61
+ #
62
+ # - occurrences (int)
63
+ # * Number of times this scheduled service has already been triggered
64
+ # * Read-only
65
+ #
66
+ # - vars (Hash)
67
+ # * Custom variables stored for this scheduled service. Variable names may be up to 32
68
+ # characters in length and can contain the characters a-z, A-Z, 0-9, and _.
69
+ # Values may be strings, numbers, or boolean (true/false).
70
+ # String values may be up to 4096 bytes in length when encoded as UTF-8.
71
+ # Up to 100 variables are supported per object.
72
+ # Setting a variable to null will delete the variable.
73
+ # * Updatable via API
74
+ #
75
+ # - project_id
76
+ # * ID of the project this scheduled service belongs to
77
+ # * Read-only
78
+ #
79
+ class ScheduledService < Entity
80
+ #
81
+ # Saves any fields or custom variables that have changed for this scheduled service.
82
+ #
83
+ def save()
84
+ super
85
+ end
86
+
87
+ #
88
+ # Cancels this scheduled service.
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 service_id
99
+ get('service_id')
100
+ end
101
+
102
+ def rrule
103
+ get('rrule')
104
+ end
105
+
106
+ def rrule=(value)
107
+ set('rrule', value)
108
+ end
109
+
110
+ def timezone_id
111
+ get('timezone_id')
112
+ end
113
+
114
+ def timezone_id=(value)
115
+ set('timezone_id', value)
116
+ end
117
+
118
+ def time_created
119
+ get('time_created')
120
+ end
121
+
122
+ def start_time
123
+ get('start_time')
124
+ end
125
+
126
+ def start_time=(value)
127
+ set('start_time', value)
128
+ end
129
+
130
+ def end_time
131
+ get('end_time')
132
+ end
133
+
134
+ def end_time=(value)
135
+ set('end_time', value)
136
+ end
137
+
138
+ def prev_time
139
+ get('prev_time')
140
+ end
141
+
142
+ def next_time
143
+ get('next_time')
144
+ end
145
+
146
+ def occurrences
147
+ get('occurrences')
148
+ end
149
+
150
+ def project_id
151
+ get('project_id')
152
+ end
153
+
154
+ def get_base_api_path()
155
+ "/projects/#{get('project_id')}/scheduled_services/#{get('id')}"
156
+ end
157
+
158
+ end
159
+
160
+ end
@@ -61,12 +61,34 @@ module Telerivet
61
61
  # * ID of the data table where responses to this service will be stored
62
62
  # * Updatable via API
63
63
  #
64
- # - phone_ids
64
+ # - phone_ids (array)
65
65
  # * IDs of phones (basic routes) associated with this service, or null if the service is
66
66
  # associated with all routes. Only applies for service types that handle incoming
67
67
  # messages, voice calls, or USSD sessions.
68
68
  # * Updatable via API
69
69
  #
70
+ # - message_types (array of strings)
71
+ # * Types of messages that this service handles. Only provided for service types that
72
+ # handle incoming messages.
73
+ # * Allowed values: text, call, ussd
74
+ # * Updatable via API
75
+ #
76
+ # - table_ids (array)
77
+ # * IDs of data tables that this service applies to, or null if this service applies to
78
+ # all data tables. Only provided for data row services (`data_row_script` and
79
+ # `data_row_actions`).
80
+ # * Updatable via API
81
+ #
82
+ # - message_statuses (array of strings)
83
+ # * Message statuses that this service handles. Only provided for
84
+ # `message_status_actions` services.
85
+ # * Allowed values: sent, delivered, failed, failed_queued, not_delivered
86
+ # * Updatable via API
87
+ #
88
+ # - tags (array)
89
+ # * Tags used to organize this service. Each tag can be up to 32 characters in length.
90
+ # * Updatable via API
91
+ #
70
92
  # - apply_mode
71
93
  # * If apply_mode is `unhandled`, the service will not be triggered if another service
72
94
  # has already handled the incoming message. If apply_mode is `always`, the service will
@@ -100,6 +122,10 @@ module Telerivet
100
122
  # * URL that a third-party can invoke to trigger this service. Only provided for
101
123
  # services that are triggered by a webhook request.
102
124
  # * Read-only
125
+ #
126
+ # - is_custom_template (bool)
127
+ # * Whether this service was created from a custom service template
128
+ # * Read-only
103
129
  #
104
130
  class Service < Entity
105
131
 
@@ -123,7 +149,8 @@ class Service < Entity
123
149
  #
124
150
  # - context
125
151
  # * The name of the context in which this service is invoked
126
- # * Allowed values: message, call, ussd_session, row, contact, project
152
+ # * Allowed values: message, call, ussd_session, row, contact, project,
153
+ # airtime_transaction
127
154
  # * Required
128
155
  #
129
156
  # - event
@@ -143,6 +170,10 @@ class Service < Entity
143
170
  # or `phone_number` is required if `context` is 'contact'). If no contact exists with
144
171
  # this phone number, a new contact will be created.
145
172
  #
173
+ # - row_id
174
+ # * The ID of the data row this service is triggered for
175
+ # * Required if context is 'row'
176
+ #
146
177
  # - variables (Hash)
147
178
  # * Object containing up to 25 temporary variable names and their corresponding values
148
179
  # to set when invoking the service. Values may be strings, numbers, or boolean
@@ -313,7 +344,8 @@ class Service < Entity
313
344
  # Gets configuration specific to the type of automated service.
314
345
  #
315
346
  # Only certain types of services provide their configuration via the
316
- # API.
347
+ # API. See [Service Configuration Reference](#service_config) for available configuration
348
+ # options.
317
349
  #
318
350
  # Returns:
319
351
  # object
@@ -333,8 +365,8 @@ class Service < Entity
333
365
  #
334
366
  # Arguments:
335
367
  # - options (Hash)
336
- # * Configuration for this service type. See
337
- # [project.createService](#Project.createService) for available configuration options.
368
+ # * Configuration for this service type. See [Service Configuration
369
+ # Reference](#service_config) for available configuration options.
338
370
  # * Required
339
371
  #
340
372
  # Returns:
@@ -414,6 +446,38 @@ class Service < Entity
414
446
  set('phone_ids', value)
415
447
  end
416
448
 
449
+ def message_types
450
+ get('message_types')
451
+ end
452
+
453
+ def message_types=(value)
454
+ set('message_types', value)
455
+ end
456
+
457
+ def table_ids
458
+ get('table_ids')
459
+ end
460
+
461
+ def table_ids=(value)
462
+ set('table_ids', value)
463
+ end
464
+
465
+ def message_statuses
466
+ get('message_statuses')
467
+ end
468
+
469
+ def message_statuses=(value)
470
+ set('message_statuses', value)
471
+ end
472
+
473
+ def tags
474
+ get('tags')
475
+ end
476
+
477
+ def tags=(value)
478
+ set('tags', value)
479
+ end
480
+
417
481
  def apply_mode
418
482
  get('apply_mode')
419
483
  end
@@ -450,6 +514,10 @@ class Service < Entity
450
514
  get('webhook_url')
451
515
  end
452
516
 
517
+ def is_custom_template
518
+ get('is_custom_template')
519
+ end
520
+
453
521
  def get_base_api_path()
454
522
  "/projects/#{get('project_id')}/services/#{get('id')}"
455
523
  end
@@ -58,6 +58,10 @@ module Telerivet
58
58
  # * Allowed values: created, queued, active, complete, failed, cancelled
59
59
  # * Read-only
60
60
  #
61
+ # - error_message (string)
62
+ # * Error message if the task failed
63
+ # * Read-only
64
+ #
61
65
  # - vars (Hash)
62
66
  # * Custom variables stored for this task. Variable names may be up to 32 characters in
63
67
  # length and can contain the characters a-z, A-Z, 0-9, and _.
@@ -135,6 +139,10 @@ class Task < Entity
135
139
  get('status')
136
140
  end
137
141
 
142
+ def error_message
143
+ get('error_message')
144
+ end
145
+
138
146
  def table_id
139
147
  get('table_id')
140
148
  end
@@ -0,0 +1,98 @@
1
+
2
+ module Telerivet
3
+
4
+ #
5
+ # Represents a webhook that is triggered when specific events occur within a project.
6
+ #
7
+ # Webhooks allow your server to receive HTTP POST requests when certain events
8
+ # happen, such as when a message's status changes or when a contact is updated.
9
+ #
10
+ # When an event occurs that matches a webhook's event types, Telerivet will
11
+ # send an HTTP POST request to the webhook URL with information about the event. For more
12
+ # information about the webhook request format, see the [Webhook API](/api/webhook)
13
+ # documentation.
14
+ #
15
+ # Note: The Webhook object is not used for notifying your server when incoming
16
+ # messages are received. To notify a URL when incoming messages are received, you can
17
+ # configure a webhook by [creating a Service](#Project.createService) with type
18
+ # incoming_message_webhook.
19
+ #
20
+ # Fields:
21
+ #
22
+ # - id (string, max 34 characters)
23
+ # * ID of the webhook
24
+ # * Read-only
25
+ #
26
+ # - url
27
+ # * URL that webhook requests are sent to
28
+ # * Updatable via API
29
+ #
30
+ # - secret
31
+ # * Secret included with webhook requests for authentication (sent as HTTP basic auth
32
+ # password with username 'telerivet')
33
+ # * Updatable via API
34
+ #
35
+ # - events (array of strings)
36
+ # * Array of event types that trigger this webhook. Possible values: `send_status`
37
+ # (message status updates), `send_broadcast` (broadcast sent), `contact_update` (contact
38
+ # added/updated/deleted), `message_metadata` (message metadata updated)
39
+ # * Updatable via API
40
+ #
41
+ # - project_id
42
+ # * ID of the project this webhook belongs to
43
+ # * Read-only
44
+ #
45
+ class Webhook < Entity
46
+ #
47
+ # Saves any fields that have changed for this webhook.
48
+ #
49
+ def save()
50
+ super
51
+ end
52
+
53
+ #
54
+ # Deletes the webhook.
55
+ #
56
+ def delete()
57
+ @api.do_request("DELETE", get_base_api_path())
58
+ end
59
+
60
+ def id
61
+ get('id')
62
+ end
63
+
64
+ def url
65
+ get('url')
66
+ end
67
+
68
+ def url=(value)
69
+ set('url', value)
70
+ end
71
+
72
+ def secret
73
+ get('secret')
74
+ end
75
+
76
+ def secret=(value)
77
+ set('secret', value)
78
+ end
79
+
80
+ def events
81
+ get('events')
82
+ end
83
+
84
+ def events=(value)
85
+ set('events', value)
86
+ end
87
+
88
+ def project_id
89
+ get('project_id')
90
+ end
91
+
92
+ def get_base_api_path()
93
+ "/projects/#{get('project_id')}/webhooks/#{get('id')}"
94
+ end
95
+
96
+ end
97
+
98
+ end
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.8.2'
12
+ @@client_version = '1.8.5'
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.8.2
4
+ version: 1.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesse Young
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-09 00:00:00.000000000 Z
11
+ date: 2026-01-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby client library for Telerivet REST API
14
14
  email: support@telerivet.com
@@ -28,14 +28,17 @@ files:
28
28
  - lib/telerivet/group.rb
29
29
  - lib/telerivet/label.rb
30
30
  - lib/telerivet/message.rb
31
+ - lib/telerivet/messagetemplate.rb
31
32
  - lib/telerivet/organization.rb
32
33
  - lib/telerivet/phone.rb
33
34
  - lib/telerivet/project.rb
34
35
  - lib/telerivet/relativescheduledmessage.rb
35
36
  - lib/telerivet/route.rb
36
37
  - lib/telerivet/scheduledmessage.rb
38
+ - lib/telerivet/scheduledservice.rb
37
39
  - lib/telerivet/service.rb
38
40
  - lib/telerivet/task.rb
41
+ - lib/telerivet/webhook.rb
39
42
  homepage: http://telerivet.com
40
43
  licenses:
41
44
  - MIT