telerivet 1.6.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cacert.pem +0 -0
- data/lib/telerivet/airtimetransaction.rb +31 -2
- data/lib/telerivet/apicursor.rb +26 -22
- data/lib/telerivet/broadcast.rb +17 -9
- data/lib/telerivet/contact.rb +13 -5
- data/lib/telerivet/contactservicestate.rb +6 -1
- data/lib/telerivet/datarow.rb +6 -1
- data/lib/telerivet/datatable.rb +19 -5
- data/lib/telerivet/entity.rb +0 -0
- data/lib/telerivet/group.rb +36 -2
- data/lib/telerivet/label.rb +7 -2
- data/lib/telerivet/message.rb +49 -8
- data/lib/telerivet/organization.rb +44 -2
- data/lib/telerivet/phone.rb +16 -9
- data/lib/telerivet/project.rb +719 -116
- data/lib/telerivet/relativescheduledmessage.rb +369 -0
- data/lib/telerivet/route.rb +7 -2
- data/lib/telerivet/scheduledmessage.rb +116 -28
- data/lib/telerivet/service.rb +143 -34
- data/lib/telerivet/task.rb +6 -1
- data/lib/telerivet.rb +16 -4
- metadata +7 -6
data/lib/telerivet/project.rb
CHANGED
@@ -19,16 +19,35 @@ module Telerivet
|
|
19
19
|
# * Updatable via API
|
20
20
|
#
|
21
21
|
# - timezone_id
|
22
|
-
# * Default TZ database timezone ID; see
|
23
|
-
#
|
24
|
-
# *
|
22
|
+
# * Default TZ database timezone ID; see [List of tz database time zones Wikipedia
|
23
|
+
# article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
24
|
+
# * Updatable via API
|
25
25
|
#
|
26
26
|
# - url_slug
|
27
27
|
# * Unique string used as a component of the project's URL in the Telerivet web app
|
28
|
-
# *
|
28
|
+
# * Updatable via API
|
29
|
+
#
|
30
|
+
# - default_route_id
|
31
|
+
# * The ID of a basic route or custom route that will be used to send messages by
|
32
|
+
# default (via both the API and web app), unless a particular route ID is specified when
|
33
|
+
# sending the message.
|
34
|
+
# * Updatable via API
|
35
|
+
#
|
36
|
+
# - auto_create_contacts (bool)
|
37
|
+
# * If true, a contact will be automatically created for each unique phone number that a
|
38
|
+
# message is sent to or received from. If false, contacts will not automatically be
|
39
|
+
# created (unless contact information is modified by an automated service). The
|
40
|
+
# Conversations tab in the web app will only show messages that are associated with a
|
41
|
+
# contact.
|
42
|
+
# * Updatable via API
|
29
43
|
#
|
30
44
|
# - vars (Hash)
|
31
|
-
# * Custom variables stored for this project
|
45
|
+
# * Custom variables stored for this project. Variable names may be up to 32 characters
|
46
|
+
# in length and can contain the characters a-z, A-Z, 0-9, and _.
|
47
|
+
# Values may be strings, numbers, or boolean (true/false).
|
48
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
49
|
+
# Up to 100 variables are supported per object.
|
50
|
+
# Setting a variable to null will delete the variable.
|
32
51
|
# * Updatable via API
|
33
52
|
#
|
34
53
|
# - organization_id (string, max 34 characters)
|
@@ -37,7 +56,7 @@ module Telerivet
|
|
37
56
|
#
|
38
57
|
class Project < Entity
|
39
58
|
#
|
40
|
-
# Sends one message (SMS, MMS, voice call, or USSD request).
|
59
|
+
# Sends one message (SMS, MMS, chat app message, voice call, or USSD request).
|
41
60
|
#
|
42
61
|
# Arguments:
|
43
62
|
# - options (Hash)
|
@@ -46,7 +65,7 @@ class Project < Entity
|
|
46
65
|
# - message_type
|
47
66
|
# * Type of message to send. If `text`, will use the default text message type for the
|
48
67
|
# selected route.
|
49
|
-
# * Allowed values: sms, mms, ussd, call,
|
68
|
+
# * Allowed values: text, sms, mms, ussd, call, chat, service
|
50
69
|
# * Default: text
|
51
70
|
#
|
52
71
|
# - content
|
@@ -72,9 +91,9 @@ class Project < Entity
|
|
72
91
|
# - status_secret
|
73
92
|
# * POST parameter 'secret' passed to status_url
|
74
93
|
#
|
75
|
-
# -
|
94
|
+
# - replace_variables (bool)
|
76
95
|
# * Set to true to evaluate variables like [[contact.name]] in message content. [(See
|
77
|
-
# available variables)](#variables)
|
96
|
+
# available variables)](#variables) (`is_template` parameter also accepted)
|
78
97
|
# * Default: false
|
79
98
|
#
|
80
99
|
# - track_clicks (boolean)
|
@@ -98,14 +117,25 @@ class Project < Entity
|
|
98
117
|
#
|
99
118
|
# - media_urls (array)
|
100
119
|
# * URLs of media files to attach to the text message. If `message_type` is `sms`,
|
101
|
-
# short links to each
|
102
|
-
#
|
120
|
+
# short links to each URL will be appended to the end of the content (separated by a
|
121
|
+
# new line).
|
122
|
+
#
|
123
|
+
#
|
124
|
+
# By default, each file must have a https:// or http:// URL, which requires the file
|
125
|
+
# to be uploaded somewhere that is accessible via the internet. For media files that
|
126
|
+
# are not already accessible via the internet, the media_urls parameter also supports
|
127
|
+
# data URIs with the file data encoded via Base64 (e.g. "data:image/png;base64,..."),
|
128
|
+
# with a maximum file size of 2 MB. To send media via data URIs, contact Telerivet to
|
129
|
+
# request enabling the data URIs feature for your project.
|
103
130
|
#
|
104
131
|
# - route_params (Hash)
|
105
|
-
# * Route-specific parameters for the message.
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
132
|
+
# * Route-specific parameters for the message.
|
133
|
+
#
|
134
|
+
# When sending messages via chat apps such as WhatsApp, the route_params
|
135
|
+
# parameter can be used to send messages with app-specific features such as quick
|
136
|
+
# replies and link buttons.
|
137
|
+
#
|
138
|
+
# For more details, see [Route-Specific Parameters](#route_params).
|
109
139
|
#
|
110
140
|
# - label_ids (array)
|
111
141
|
# * List of IDs of labels to add to this message
|
@@ -174,7 +204,7 @@ class Project < Entity
|
|
174
204
|
# - message_type
|
175
205
|
# * Type of message to send. If `text`, will use the default text message type for the
|
176
206
|
# selected route.
|
177
|
-
# * Allowed values: sms, mms, call,
|
207
|
+
# * Allowed values: text, sms, mms, call, chat, service
|
178
208
|
# * Default: text
|
179
209
|
#
|
180
210
|
# - content
|
@@ -212,9 +242,9 @@ class Project < Entity
|
|
212
242
|
# * Optionally excludes one contact from receiving the message (only when group_id is
|
213
243
|
# set)
|
214
244
|
#
|
215
|
-
# -
|
245
|
+
# - replace_variables (bool)
|
216
246
|
# * Set to true to evaluate variables like [[contact.name]] in message content [(See
|
217
|
-
# available variables)](#variables)
|
247
|
+
# available variables)](#variables) (`is_template` parameter also accepted)
|
218
248
|
# * Default: false
|
219
249
|
#
|
220
250
|
# - track_clicks (boolean)
|
@@ -240,15 +270,26 @@ class Project < Entity
|
|
240
270
|
# * URLs of media files to attach to the text message. If `message_type` is `sms`,
|
241
271
|
# short links to each URL will be appended to the end of the content (separated by a
|
242
272
|
# new line).
|
273
|
+
#
|
274
|
+
#
|
275
|
+
# By default, each file must have a https:// or http:// URL, which requires the file
|
276
|
+
# to be uploaded somewhere that is accessible via the internet. For media files that
|
277
|
+
# are not already accessible via the internet, the media_urls parameter also supports
|
278
|
+
# data URIs with the file data encoded via Base64 (e.g. "data:image/png;base64,..."),
|
279
|
+
# with a maximum file size of 2 MB. To send media via data URIs, contact Telerivet to
|
280
|
+
# request enabling the data URIs feature for your project.
|
243
281
|
#
|
244
282
|
# - vars (Hash)
|
245
283
|
# * Custom variables to set for each message
|
246
284
|
#
|
247
285
|
# - route_params (Hash)
|
248
|
-
# * Route-specific parameters for the messages in the broadcast.
|
249
|
-
#
|
250
|
-
#
|
251
|
-
#
|
286
|
+
# * Route-specific parameters for the messages in the broadcast.
|
287
|
+
#
|
288
|
+
# When sending messages via chat apps such as WhatsApp, the route_params
|
289
|
+
# parameter can be used to send messages with app-specific features such as quick
|
290
|
+
# replies and link buttons.
|
291
|
+
#
|
292
|
+
# For more details, see [Route-Specific Parameters](#route_params).
|
252
293
|
#
|
253
294
|
# - service_id
|
254
295
|
# * Service to invoke for each recipient (when `message_type` is `call` or `service`)
|
@@ -302,7 +343,7 @@ class Project < Entity
|
|
302
343
|
# - message_type
|
303
344
|
# * Type of message to send. If `text`, will use the default text message type for the
|
304
345
|
# selected route.
|
305
|
-
# * Allowed values: sms, mms, chat,
|
346
|
+
# * Allowed values: text, sms, mms, call, chat, service
|
306
347
|
# * Default: text
|
307
348
|
#
|
308
349
|
# - route_id
|
@@ -330,9 +371,9 @@ class Project < Entity
|
|
330
371
|
# - label_ids (array)
|
331
372
|
# * Array of IDs of labels to add to each message (maximum 5)
|
332
373
|
#
|
333
|
-
# -
|
374
|
+
# - replace_variables (bool)
|
334
375
|
# * Set to true to evaluate variables like [[contact.name]] in message content [(See
|
335
|
-
# available variables)](#variables)
|
376
|
+
# available variables)](#variables) (`is_template` parameter also accepted)
|
336
377
|
# * Default: false
|
337
378
|
#
|
338
379
|
# - track_clicks (boolean)
|
@@ -356,14 +397,25 @@ class Project < Entity
|
|
356
397
|
#
|
357
398
|
# - media_urls (array)
|
358
399
|
# * URLs of media files to attach to the text message. If `message_type` is `sms`,
|
359
|
-
# short links to each
|
360
|
-
#
|
400
|
+
# short links to each URL will be appended to the end of the content (separated by a
|
401
|
+
# new line).
|
402
|
+
#
|
403
|
+
#
|
404
|
+
# By default, each file must have a https:// or http:// URL, which requires the file
|
405
|
+
# to be uploaded somewhere that is accessible via the internet. For media files that
|
406
|
+
# are not already accessible via the internet, the media_urls parameter also supports
|
407
|
+
# data URIs with the file data encoded via Base64 (e.g. "data:image/png;base64,..."),
|
408
|
+
# with a maximum file size of 2 MB. To send media via data URIs, contact Telerivet to
|
409
|
+
# request enabling the data URIs feature for your project.
|
361
410
|
#
|
362
411
|
# - route_params (Hash)
|
363
|
-
# * Route-specific parameters to apply to all messages.
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
412
|
+
# * Route-specific parameters to apply to all messages.
|
413
|
+
#
|
414
|
+
# When sending messages via chat apps such as WhatsApp, the route_params
|
415
|
+
# parameter can be used to send messages with app-specific features such as quick
|
416
|
+
# replies and link buttons.
|
417
|
+
#
|
418
|
+
# For more details, see [Route-Specific Parameters](#route_params).
|
367
419
|
#
|
368
420
|
# - vars (Hash)
|
369
421
|
# * Custom variables to store with the message
|
@@ -441,6 +493,9 @@ class Project < Entity
|
|
441
493
|
# messages approximately once every 15 seconds, so it is not possible to control the exact
|
442
494
|
# second at which a scheduled message is sent.
|
443
495
|
#
|
496
|
+
# Only one of the parameters group_id, to_number, and contact_id
|
497
|
+
# should be provided.
|
498
|
+
#
|
444
499
|
# With `message_type`=`service`, schedules an automated service (such
|
445
500
|
# as a poll) to be invoked for a group or list of phone numbers. Any service that can be
|
446
501
|
# triggered for a contact can be scheduled via this method, whether or not the service
|
@@ -452,20 +507,21 @@ class Project < Entity
|
|
452
507
|
#
|
453
508
|
# - message_type
|
454
509
|
# * Type of message to send
|
455
|
-
# * Allowed values: sms, ussd, call, service
|
456
|
-
# * Default:
|
510
|
+
# * Allowed values: text, sms, mms, ussd, call, chat, service
|
511
|
+
# * Default: text
|
457
512
|
#
|
458
513
|
# - content
|
459
514
|
# * Content of the message to schedule
|
460
|
-
# * Required if sending
|
515
|
+
# * Required if sending text message
|
461
516
|
#
|
462
517
|
# - group_id
|
463
518
|
# * ID of the group to send the message to
|
464
|
-
# * Required if to_number not set
|
465
519
|
#
|
466
520
|
# - to_number (string)
|
467
521
|
# * Phone number to send the message to
|
468
|
-
#
|
522
|
+
#
|
523
|
+
# - contact_id (string)
|
524
|
+
# * ID of the contact to send the message to
|
469
525
|
#
|
470
526
|
# - start_time (UNIX timestamp)
|
471
527
|
# * The time that the message will be sent (or first sent for recurring messages)
|
@@ -530,20 +586,32 @@ class Project < Entity
|
|
530
586
|
# destination URL.
|
531
587
|
# If null, the short links will not expire.
|
532
588
|
#
|
533
|
-
# -
|
589
|
+
# - replace_variables (bool)
|
534
590
|
# * Set to true to evaluate variables like [[contact.name]] in message content
|
591
|
+
# (`is_template` parameter also accepted)
|
535
592
|
# * Default: false
|
536
593
|
#
|
537
594
|
# - media_urls (array)
|
538
595
|
# * URLs of media files to attach to the text message. If `message_type` is `sms`,
|
539
|
-
# short links to each
|
540
|
-
#
|
596
|
+
# short links to each URL will be appended to the end of the content (separated by a
|
597
|
+
# new line).
|
598
|
+
#
|
599
|
+
#
|
600
|
+
# By default, each file must have a https:// or http:// URL, which requires the file
|
601
|
+
# to be uploaded somewhere that is accessible via the internet. For media files that
|
602
|
+
# are not already accessible via the internet, the media_urls parameter also supports
|
603
|
+
# data URIs with the file data encoded via Base64 (e.g. "data:image/png;base64,..."),
|
604
|
+
# with a maximum file size of 2 MB. To send media via data URIs, contact Telerivet to
|
605
|
+
# request enabling the data URIs feature for your project.
|
541
606
|
#
|
542
607
|
# - route_params (Hash)
|
543
|
-
# * Route-specific parameters to use when sending the message.
|
544
|
-
#
|
545
|
-
#
|
546
|
-
#
|
608
|
+
# * Route-specific parameters to use when sending the message.
|
609
|
+
#
|
610
|
+
# When sending messages via chat apps such as WhatsApp, the route_params
|
611
|
+
# parameter can be used to send messages with app-specific features such as quick
|
612
|
+
# replies and link buttons.
|
613
|
+
#
|
614
|
+
# For more details, see [Route-Specific Parameters](#route_params).
|
547
615
|
#
|
548
616
|
# - label_ids (array)
|
549
617
|
# * Array of IDs of labels to add to the sent messages (maximum 5). Does not apply
|
@@ -551,8 +619,8 @@ class Project < Entity
|
|
551
619
|
# itself.
|
552
620
|
#
|
553
621
|
# - timezone_id
|
554
|
-
# * TZ database timezone ID; see
|
555
|
-
#
|
622
|
+
# * TZ database timezone ID; see [List of tz database time zones Wikipedia
|
623
|
+
# article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
556
624
|
# * Default: project default timezone
|
557
625
|
#
|
558
626
|
# - end_time (UNIX timestamp)
|
@@ -574,6 +642,177 @@ class Project < Entity
|
|
574
642
|
ScheduledMessage.new(@api, @api.do_request("POST", get_base_api_path() + "/scheduled", options))
|
575
643
|
end
|
576
644
|
|
645
|
+
#
|
646
|
+
# Creates a relative scheduled message. This allows scheduling messages on a different date
|
647
|
+
# for each contact, for example on their birthday, a certain number of days before an
|
648
|
+
# appointment, or a certain number of days after enrolling in a campaign.
|
649
|
+
#
|
650
|
+
# Telerivet will automatically create a
|
651
|
+
# [ScheduledMessage](#ScheduledMessage) for each contact matching a RelativeScheduledMessage.
|
652
|
+
#
|
653
|
+
# Relative scheduled messages can be created for a group or an
|
654
|
+
# individual contact, although dynamic groups are not supported. Only one of the parameters
|
655
|
+
# group_id, to_number, and contact_id should be provided.
|
656
|
+
#
|
657
|
+
# With message_type=service, schedules an automated service (such as a
|
658
|
+
# poll). Any service that can be triggered for a contact can be scheduled via this method,
|
659
|
+
# whether or not the service actually sends a message.
|
660
|
+
#
|
661
|
+
# Arguments:
|
662
|
+
# - options (Hash)
|
663
|
+
# * Required
|
664
|
+
#
|
665
|
+
# - message_type
|
666
|
+
# * Type of message to send
|
667
|
+
# * Allowed values: text, sms, mms, call, chat, service
|
668
|
+
# * Default: text
|
669
|
+
#
|
670
|
+
# - content
|
671
|
+
# * Content of the message to schedule
|
672
|
+
# * Required if sending text message
|
673
|
+
#
|
674
|
+
# - group_id
|
675
|
+
# * ID of the group to send the message to. Dynamic groups are not supported.
|
676
|
+
#
|
677
|
+
# - to_number (string)
|
678
|
+
# * Phone number to send the message to
|
679
|
+
#
|
680
|
+
# - contact_id (string)
|
681
|
+
# * ID of the contact to send the message to
|
682
|
+
#
|
683
|
+
# - time_of_day
|
684
|
+
# * Time of day when scheduled messages will be sent in HH:MM format (with hours from
|
685
|
+
# 00 to 23)
|
686
|
+
# * Required
|
687
|
+
#
|
688
|
+
# - timezone_id
|
689
|
+
# * TZ database timezone ID; see [List of tz database time zones Wikipedia
|
690
|
+
# article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
|
691
|
+
# * Default: project default timezone
|
692
|
+
#
|
693
|
+
# - date_variable
|
694
|
+
# * Custom contact variable storing date or date/time values relative to which
|
695
|
+
# messages will be scheduled.
|
696
|
+
# * Required
|
697
|
+
#
|
698
|
+
# - offset_scale
|
699
|
+
# * The type of interval (day/week/month/year) that will be used to adjust the
|
700
|
+
# scheduled date relative to the date stored in the contact's date_variable, when
|
701
|
+
# offset_count is non-zero (D=day, W=week, M=month, Y=year)
|
702
|
+
# * Allowed values: D, W, M, Y
|
703
|
+
# * Default: D
|
704
|
+
#
|
705
|
+
# - offset_count (int)
|
706
|
+
# * The number of days/weeks/months/years to adjust the date of the scheduled message
|
707
|
+
# relative relative to the date stored in the custom contact variable identified by
|
708
|
+
# the date_variable parameter. May be positive, negative, or zero.
|
709
|
+
# * Default: 0
|
710
|
+
#
|
711
|
+
# - rrule
|
712
|
+
# * A recurrence rule describing the how the schedule repeats, e.g. 'FREQ=MONTHLY' or
|
713
|
+
# 'FREQ=WEEKLY;INTERVAL=2'; see <https://tools.ietf.org/html/rfc2445#section-4.3.10>.
|
714
|
+
# (UNTIL is ignored; use end_time parameter instead).
|
715
|
+
# * Default: COUNT=1 (one-time scheduled message, does not repeat)
|
716
|
+
#
|
717
|
+
# - route_id
|
718
|
+
# * ID of the phone or route to send the message from
|
719
|
+
# * Default: default sender route ID
|
720
|
+
#
|
721
|
+
# - service_id
|
722
|
+
# * Service to invoke for each recipient (when `message_type` is `call` or `service`)
|
723
|
+
# * Required if message_type is service
|
724
|
+
#
|
725
|
+
# - audio_url
|
726
|
+
# * The URL of an MP3 file to play when the contact answers the call (when
|
727
|
+
# `message_type` is `call`).
|
728
|
+
#
|
729
|
+
# If `audio_url` is provided, the text-to-speech voice is not used to say
|
730
|
+
# `content`, although you can optionally use `content` to indicate the script for the
|
731
|
+
# audio.
|
732
|
+
#
|
733
|
+
# For best results, use an MP3 file containing only speech. Music is not
|
734
|
+
# recommended because the audio quality will be low when played over a phone line.
|
735
|
+
#
|
736
|
+
# - tts_lang
|
737
|
+
# * The language of the text-to-speech voice (when `message_type` is `call`)
|
738
|
+
# * Allowed values: en-US, en-GB, en-GB-WLS, en-AU, en-IN, da-DK, nl-NL, fr-FR, fr-CA,
|
739
|
+
# de-DE, is-IS, it-IT, pl-PL, pt-BR, pt-PT, ru-RU, es-ES, es-US, sv-SE
|
740
|
+
# * Default: en-US
|
741
|
+
#
|
742
|
+
# - tts_voice
|
743
|
+
# * The name of the text-to-speech voice (when message_type=call)
|
744
|
+
# * Allowed values: female, male
|
745
|
+
# * Default: female
|
746
|
+
#
|
747
|
+
# - track_clicks (boolean)
|
748
|
+
# * If true, URLs in the message content will automatically be replaced with unique
|
749
|
+
# short URLs.
|
750
|
+
# * Default: false
|
751
|
+
#
|
752
|
+
# - short_link_params (Hash)
|
753
|
+
# *
|
754
|
+
# If `track_clicks` is true, `short_link_params` may be used to specify
|
755
|
+
# custom parameters for each short link in the message. The following parameters are
|
756
|
+
# supported:
|
757
|
+
#
|
758
|
+
# `domain` (string): A custom short domain name to use for the short
|
759
|
+
# links. The domain name must already be registered for your project or organization.
|
760
|
+
#
|
761
|
+
# `expiration_sec` (integer): The number of seconds after the message is
|
762
|
+
# created (queued to send) when the short links will stop forwarding to the
|
763
|
+
# destination URL.
|
764
|
+
# If null, the short links will not expire.
|
765
|
+
#
|
766
|
+
# - replace_variables (bool)
|
767
|
+
# * Set to true to evaluate variables like [[contact.name]] in message content
|
768
|
+
# * Default: false
|
769
|
+
#
|
770
|
+
# - media_urls (array)
|
771
|
+
# * URLs of media files to attach to the text message. If `message_type` is `sms`,
|
772
|
+
# short links to each URL will be appended to the end of the content (separated by a
|
773
|
+
# new line).
|
774
|
+
#
|
775
|
+
#
|
776
|
+
# By default, each file must have a https:// or http:// URL, which requires the file
|
777
|
+
# to be uploaded somewhere that is accessible via the internet. For media files that
|
778
|
+
# are not already accessible via the internet, the media_urls parameter also supports
|
779
|
+
# data URIs with the file data encoded via Base64 (e.g. "data:image/png;base64,..."),
|
780
|
+
# with a maximum file size of 2 MB. To send media via data URIs, contact Telerivet to
|
781
|
+
# request enabling the data URIs feature for your project.
|
782
|
+
#
|
783
|
+
# - route_params (Hash)
|
784
|
+
# * Route-specific parameters to use when sending the message.
|
785
|
+
#
|
786
|
+
# When sending messages via chat apps such as WhatsApp, the route_params
|
787
|
+
# parameter can be used to send messages with app-specific features such as quick
|
788
|
+
# replies and link buttons.
|
789
|
+
#
|
790
|
+
# For more details, see [Route-Specific Parameters](#route_params).
|
791
|
+
#
|
792
|
+
# - label_ids (array)
|
793
|
+
# * Array of IDs of labels to add to the sent messages (maximum 5). Does not apply
|
794
|
+
# when `message_type`=`service`, since the labels are determined by the service
|
795
|
+
# itself.
|
796
|
+
#
|
797
|
+
# - end_time (UNIX timestamp)
|
798
|
+
# * Time after which a recurring message will stop (not applicable to non-recurring
|
799
|
+
# scheduled messages)
|
800
|
+
#
|
801
|
+
# - end_time_offset (int)
|
802
|
+
# * Number of seconds from now until the recurring message will stop
|
803
|
+
#
|
804
|
+
# - vars (Hash)
|
805
|
+
# * Custom variables to set for this relative scheduled message, which will be copied
|
806
|
+
# to each message sent from this scheduled message
|
807
|
+
#
|
808
|
+
# Returns:
|
809
|
+
# Telerivet::RelativeScheduledMessage
|
810
|
+
#
|
811
|
+
def create_relative_scheduled_message(options)
|
812
|
+
require_relative 'relativescheduledmessage'
|
813
|
+
RelativeScheduledMessage.new(@api, @api.do_request("POST", get_base_api_path() + "/relative_scheduled", options))
|
814
|
+
end
|
815
|
+
|
577
816
|
#
|
578
817
|
# Add an incoming message to Telerivet. Acts the same as if the message was received by a
|
579
818
|
# phone. Also triggers any automated services that apply to the message.
|
@@ -588,7 +827,7 @@ class Project < Entity
|
|
588
827
|
#
|
589
828
|
# - message_type
|
590
829
|
# * Type of message
|
591
|
-
# * Allowed values: sms, call
|
830
|
+
# * Allowed values: sms, call, chat
|
592
831
|
# * Default: sms
|
593
832
|
#
|
594
833
|
# - from_number
|
@@ -670,7 +909,12 @@ class Project < Entity
|
|
670
909
|
# * ID of one or more groups to remove this contact as a member (max 20)
|
671
910
|
#
|
672
911
|
# - vars (Hash)
|
673
|
-
# * Custom variables and values to update on the contact
|
912
|
+
# * Custom variables and values to update on the contact. Variable names may be up to
|
913
|
+
# 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _.
|
914
|
+
# Values may be strings, numbers, or boolean (true/false).
|
915
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
916
|
+
# Up to 100 variables are supported per object.
|
917
|
+
# Setting a variable to null will delete the variable.
|
674
918
|
#
|
675
919
|
# Returns:
|
676
920
|
# Telerivet::Contact
|
@@ -848,7 +1092,7 @@ class Project < Entity
|
|
848
1092
|
end
|
849
1093
|
|
850
1094
|
#
|
851
|
-
# Queries
|
1095
|
+
# Queries basic routes within the given project.
|
852
1096
|
#
|
853
1097
|
# Arguments:
|
854
1098
|
# - options (Hash)
|
@@ -896,7 +1140,7 @@ class Project < Entity
|
|
896
1140
|
end
|
897
1141
|
|
898
1142
|
#
|
899
|
-
# Retrieves the
|
1143
|
+
# Retrieves the basic route with the given ID.
|
900
1144
|
#
|
901
1145
|
# Arguments:
|
902
1146
|
# - id
|
@@ -912,7 +1156,7 @@ class Project < Entity
|
|
912
1156
|
end
|
913
1157
|
|
914
1158
|
#
|
915
|
-
# Initializes the
|
1159
|
+
# Initializes the basic route with the given ID without making an API request.
|
916
1160
|
#
|
917
1161
|
# Arguments:
|
918
1162
|
# - id
|
@@ -942,7 +1186,7 @@ class Project < Entity
|
|
942
1186
|
#
|
943
1187
|
# - message_type
|
944
1188
|
# * Filter messages by message_type
|
945
|
-
# * Allowed values: sms, mms, ussd, call, service
|
1189
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
946
1190
|
#
|
947
1191
|
# - source
|
948
1192
|
# * Filter messages by source
|
@@ -1152,50 +1396,44 @@ class Project < Entity
|
|
1152
1396
|
#
|
1153
1397
|
# Tasks for contacts:
|
1154
1398
|
#
|
1155
|
-
# -
|
1156
|
-
# -
|
1157
|
-
# -
|
1158
|
-
# -
|
1159
|
-
# -
|
1160
|
-
# -
|
1161
|
-
# -
|
1162
|
-
# -
|
1399
|
+
# - update_contact_var
|
1400
|
+
# - add_group_members
|
1401
|
+
# - remove_group_members
|
1402
|
+
# - set_conversation_status
|
1403
|
+
# - set_send_blocked
|
1404
|
+
# - apply_service_to_contacts
|
1405
|
+
# - delete_contacts
|
1406
|
+
# - export_contacts
|
1163
1407
|
#
|
1164
1408
|
# Tasks for data rows:
|
1165
1409
|
#
|
1166
|
-
# -
|
1167
|
-
# -
|
1168
|
-
# -
|
1169
|
-
# -
|
1410
|
+
# - update_row_var
|
1411
|
+
# - apply_service_to_rows
|
1412
|
+
# - delete_rows
|
1413
|
+
# - export_rows
|
1170
1414
|
#
|
1171
1415
|
# Tasks for messages:
|
1172
1416
|
#
|
1173
|
-
# -
|
1174
|
-
# -
|
1175
|
-
# -
|
1176
|
-
# -
|
1177
|
-
# -
|
1178
|
-
# -
|
1179
|
-
# -
|
1180
|
-
# -
|
1181
|
-
# -
|
1182
|
-
# * Allowed values: update_contact_var, delete_contacts, add_group_members,
|
1183
|
-
# remove_group_members, set_conversation_status, set_send_blocked,
|
1184
|
-
# apply_service_to_contacts, update_row_var, delete_rows, apply_service_to_rows,
|
1185
|
-
# delete_messages, cancel_messages, resend_messages, retry_message_services,
|
1186
|
-
# apply_service_to_messages, add_label, remove_label, update_message_var,
|
1187
|
-
# export_messages, export_contacts, export_rows
|
1417
|
+
# - cancel_messages
|
1418
|
+
# - resend_messages
|
1419
|
+
# - retry_message_services
|
1420
|
+
# - apply_service_to_messages
|
1421
|
+
# - add_label
|
1422
|
+
# - remove_label
|
1423
|
+
# - update_message_var
|
1424
|
+
# - delete_messages
|
1425
|
+
# - export_messages
|
1188
1426
|
# * Required
|
1189
1427
|
#
|
1190
1428
|
# - task_params (Hash)
|
1191
1429
|
# * Parameters applied to all matching rows (specific to `task_type`).
|
1192
1430
|
#
|
1193
|
-
#
|
1194
|
-
#
|
1431
|
+
# **apply_service_to_contacts**,
|
1432
|
+
# **apply_service_to_messages**, **apply_service_to_rows**:
|
1195
1433
|
# <table>
|
1196
|
-
# <tr><td>
|
1197
|
-
#
|
1198
|
-
# <tr><td>
|
1434
|
+
# <tr><td> service_id </td> <td> The ID of the service
|
1435
|
+
# to apply (string) </td></tr>
|
1436
|
+
# <tr><td> variables </td> <td> Optional object
|
1199
1437
|
# containing up to 25 temporary variable names and their corresponding values to set
|
1200
1438
|
# when invoking the service. Values may be strings, numbers, or boolean (true/false).
|
1201
1439
|
# String values may be up to 4096 bytes in length. Arrays and objects are not
|
@@ -1205,49 +1443,49 @@ class Project < Entity
|
|
1205
1443
|
# JavaScript variable like $name (with a leading $ character). (object) </td></tr>
|
1206
1444
|
# </table>
|
1207
1445
|
# <br />
|
1208
|
-
#
|
1209
|
-
#
|
1446
|
+
# **update_contact_var**, **update_message_var**,
|
1447
|
+
# **update_row_var**:
|
1210
1448
|
# <table>
|
1211
|
-
# <tr><td>
|
1449
|
+
# <tr><td> variable </td> <td> The custom variable
|
1212
1450
|
# name (string) </td></tr>
|
1213
|
-
# <tr><td>
|
1214
|
-
#
|
1451
|
+
# <tr><td> value </td> <td> The value to set (string,
|
1452
|
+
# boolean, float, null) </td></tr>
|
1215
1453
|
# </table>
|
1216
1454
|
# <br />
|
1217
|
-
#
|
1455
|
+
# **add_group_members**, **remove_group_members**:
|
1218
1456
|
# <table>
|
1219
|
-
# <tr><td>
|
1457
|
+
# <tr><td> group_id </td> <td> The ID of the group
|
1220
1458
|
# (string) </td></tr>
|
1221
1459
|
# </table>
|
1222
1460
|
# <br />
|
1223
|
-
#
|
1461
|
+
# **add_label**, **remove_label**:
|
1224
1462
|
# <table>
|
1225
|
-
# <tr><td>
|
1463
|
+
# <tr><td> label_id </td> <td> The ID of the label
|
1226
1464
|
# (string) </td></tr>
|
1227
1465
|
# </table>
|
1228
1466
|
# <br />
|
1229
|
-
#
|
1467
|
+
# **resend_messages**:
|
1230
1468
|
# <table>
|
1231
|
-
# <tr><td>
|
1232
|
-
#
|
1469
|
+
# <tr><td> route_id </td> <td> ID of the new route to
|
1470
|
+
# use, or null to use the original route (string) </td></tr>
|
1233
1471
|
# </table>
|
1234
1472
|
# <br />
|
1235
|
-
#
|
1473
|
+
# **set_send_blocked**:
|
1236
1474
|
# <table>
|
1237
|
-
# <tr><td>
|
1238
|
-
# sending messages,
|
1475
|
+
# <tr><td> send_blocked </td> <td> true to block
|
1476
|
+
# sending messages, false to unblock sending messages (boolean) </td></tr>
|
1239
1477
|
# </table>
|
1240
1478
|
# <br />
|
1241
|
-
#
|
1479
|
+
# **set_conversation_status**:
|
1242
1480
|
# <table>
|
1243
|
-
# <tr><td>
|
1481
|
+
# <tr><td> conversation_status </td> <td> "active",
|
1244
1482
|
# "handled", or "closed" (string) </td></tr>
|
1245
1483
|
# </table>
|
1246
1484
|
# <br />
|
1247
|
-
#
|
1248
|
-
#
|
1485
|
+
# **export_contacts**, **export_messages**,
|
1486
|
+
# **export_rows**:
|
1249
1487
|
# <table>
|
1250
|
-
# <tr><td
|
1488
|
+
# <tr><td>storage_id </td> <td> ID of a storage
|
1251
1489
|
# provider where the CSV file will be saved. (string)
|
1252
1490
|
#
|
1253
1491
|
# Currently only AWS S3 is supported as a storage
|
@@ -1261,15 +1499,15 @@ class Project < Entity
|
|
1261
1499
|
# Direct downloads are not supported when
|
1262
1500
|
# exporting data via the API.
|
1263
1501
|
# (string) </td></tr>
|
1264
|
-
# <tr><td
|
1265
|
-
#
|
1266
|
-
# <tr><td
|
1267
|
-
#
|
1502
|
+
# <tr><td>filename </td> <td> Path within the storage
|
1503
|
+
# backend where the CSV file will be saved </td></tr>
|
1504
|
+
# <tr><td>column_ids </td> <td> IDs of columns to save
|
1505
|
+
# in the CSV file. If not provided, all default columns will be saved. (array of
|
1268
1506
|
# strings, optional) </td></tr>
|
1269
1507
|
# </table>
|
1270
1508
|
# <br />
|
1271
|
-
#
|
1272
|
-
#
|
1509
|
+
# **delete_contacts**, **delete_messages**,
|
1510
|
+
# **delete_rows**, **cancel_messages**, **retry_message_services**: <br />
|
1273
1511
|
# No parameters.
|
1274
1512
|
#
|
1275
1513
|
# - filter_type
|
@@ -1678,7 +1916,7 @@ class Project < Entity
|
|
1678
1916
|
#
|
1679
1917
|
# - message_type
|
1680
1918
|
# * Filter scheduled messages by message_type
|
1681
|
-
# * Allowed values: sms, mms, ussd, call, service
|
1919
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
1682
1920
|
#
|
1683
1921
|
# - time_created (UNIX timestamp)
|
1684
1922
|
# * Filter scheduled messages by time_created
|
@@ -1688,6 +1926,9 @@ class Project < Entity
|
|
1688
1926
|
# * Filter scheduled messages by next_time
|
1689
1927
|
# * Allowed modifiers: next_time[min], next_time[max], next_time[exists]
|
1690
1928
|
#
|
1929
|
+
# - relative_scheduled_id
|
1930
|
+
# * Filter scheduled messages created for a relative scheduled message
|
1931
|
+
#
|
1691
1932
|
# - sort
|
1692
1933
|
# * Sort the results based on a field
|
1693
1934
|
# * Allowed values: default, next_time
|
@@ -1714,6 +1955,52 @@ class Project < Entity
|
|
1714
1955
|
@api.cursor(ScheduledMessage, get_base_api_path() + "/scheduled", options)
|
1715
1956
|
end
|
1716
1957
|
|
1958
|
+
#
|
1959
|
+
# Queries relative scheduled messages within the given project.
|
1960
|
+
#
|
1961
|
+
# Arguments:
|
1962
|
+
# - options (Hash)
|
1963
|
+
#
|
1964
|
+
# - message_type
|
1965
|
+
# * Filter relative scheduled messages by message_type
|
1966
|
+
# * Allowed values: sms, mms, ussd, ussd_session, call, chat, service
|
1967
|
+
#
|
1968
|
+
# - time_created (UNIX timestamp)
|
1969
|
+
# * Filter relative scheduled messages by time_created
|
1970
|
+
# * Allowed modifiers: time_created[min], time_created[max]
|
1971
|
+
#
|
1972
|
+
# - group_id
|
1973
|
+
# * Filter relative scheduled messages sent to a group
|
1974
|
+
#
|
1975
|
+
# - contact_id
|
1976
|
+
# * Filter relative scheduled messages sent to an individual contact
|
1977
|
+
#
|
1978
|
+
# - sort
|
1979
|
+
# * Sort the results based on a field
|
1980
|
+
# * Allowed values: default
|
1981
|
+
# * Default: default
|
1982
|
+
#
|
1983
|
+
# - sort_dir
|
1984
|
+
# * Sort the results in ascending or descending order
|
1985
|
+
# * Allowed values: asc, desc
|
1986
|
+
# * Default: asc
|
1987
|
+
#
|
1988
|
+
# - page_size (int)
|
1989
|
+
# * Number of results returned per page (max 500)
|
1990
|
+
# * Default: 50
|
1991
|
+
#
|
1992
|
+
# - offset (int)
|
1993
|
+
# * Number of items to skip from beginning of result set
|
1994
|
+
# * Default: 0
|
1995
|
+
#
|
1996
|
+
# Returns:
|
1997
|
+
# Telerivet::APICursor (of Telerivet::RelativeScheduledMessage)
|
1998
|
+
#
|
1999
|
+
def query_relative_scheduled_messages(options = nil)
|
2000
|
+
require_relative 'relativescheduledmessage'
|
2001
|
+
@api.cursor(RelativeScheduledMessage, get_base_api_path() + "/relative_scheduled", options)
|
2002
|
+
end
|
2003
|
+
|
1717
2004
|
#
|
1718
2005
|
# Retrieves the scheduled message with the given ID.
|
1719
2006
|
#
|
@@ -1746,6 +2033,184 @@ class Project < Entity
|
|
1746
2033
|
return ScheduledMessage.new(@api, {'project_id' => self.id, 'id' => id}, false)
|
1747
2034
|
end
|
1748
2035
|
|
2036
|
+
#
|
2037
|
+
# Retrieves the scheduled message with the given ID.
|
2038
|
+
#
|
2039
|
+
# Arguments:
|
2040
|
+
# - id
|
2041
|
+
# * ID of the relative scheduled message
|
2042
|
+
# * Required
|
2043
|
+
#
|
2044
|
+
# Returns:
|
2045
|
+
# Telerivet::RelativeScheduledMessage
|
2046
|
+
#
|
2047
|
+
def get_relative_scheduled_message_by_id(id)
|
2048
|
+
require_relative 'relativescheduledmessage'
|
2049
|
+
RelativeScheduledMessage.new(@api, @api.do_request("GET", get_base_api_path() + "/relative_scheduled/#{id}"))
|
2050
|
+
end
|
2051
|
+
|
2052
|
+
#
|
2053
|
+
# Initializes the relative scheduled message with the given ID without making an API request.
|
2054
|
+
#
|
2055
|
+
# Arguments:
|
2056
|
+
# - id
|
2057
|
+
# * ID of the relative scheduled message
|
2058
|
+
# * Required
|
2059
|
+
#
|
2060
|
+
# Returns:
|
2061
|
+
# Telerivet::RelativeScheduledMessage
|
2062
|
+
#
|
2063
|
+
def init_relative_scheduled_message_by_id(id)
|
2064
|
+
require_relative 'relativescheduledmessage'
|
2065
|
+
return RelativeScheduledMessage.new(@api, {'project_id' => self.id, 'id' => id}, false)
|
2066
|
+
end
|
2067
|
+
|
2068
|
+
#
|
2069
|
+
# Creates a new automated service.
|
2070
|
+
#
|
2071
|
+
# Only certain types of automated services can be created via the API.
|
2072
|
+
# Other types of services can only be created via the web app.
|
2073
|
+
#
|
2074
|
+
# Although Custom Actions services cannot be created directly via the
|
2075
|
+
# API, they may be converted to a template,
|
2076
|
+
# and then instances of the template can be created via this method
|
2077
|
+
# with `service_type`=`custom_template_instance`. Converting a service
|
2078
|
+
# to a template requires the Service Templates feature to be enabled
|
2079
|
+
# for the organization.
|
2080
|
+
#
|
2081
|
+
# Arguments:
|
2082
|
+
# - options (Hash)
|
2083
|
+
# * Required
|
2084
|
+
#
|
2085
|
+
# - name (string)
|
2086
|
+
# * Name of the service to create, which must be unique in the project. If a name is
|
2087
|
+
# not provided, a unique default name will be generated.
|
2088
|
+
#
|
2089
|
+
# - service_type (string)
|
2090
|
+
# * Type of service to create. The following service types can be created via the
|
2091
|
+
# API:
|
2092
|
+
#
|
2093
|
+
# - incoming_message_webhook
|
2094
|
+
# - incoming_message_script
|
2095
|
+
# - contact_script
|
2096
|
+
# - message_script
|
2097
|
+
# - data_row_script
|
2098
|
+
# - webhook_script
|
2099
|
+
# - voice_script
|
2100
|
+
# - ussd_script
|
2101
|
+
# - project_script
|
2102
|
+
# - custom_template_instance
|
2103
|
+
#
|
2104
|
+
# Other types of services can only be created via the web app.
|
2105
|
+
# * Required
|
2106
|
+
#
|
2107
|
+
# - config (Hash)
|
2108
|
+
# * Configuration specific to the service `type`.
|
2109
|
+
#
|
2110
|
+
# **incoming_message_webhook**:
|
2111
|
+
# <table>
|
2112
|
+
# <tr><td> url </td> <td> The webhook URL that will be
|
2113
|
+
# triggered when an incoming message is received (string) </td></tr>
|
2114
|
+
# <tr><td> secret </td> <td> Optional string that will
|
2115
|
+
# be passed as the `secret` POST parameter to the webhook URL. (object) </td></tr>
|
2116
|
+
# </table>
|
2117
|
+
# <br />
|
2118
|
+
#
|
2119
|
+
# **incoming_message_script, contact_script,
|
2120
|
+
# message_script, data_row_script, webhook_script, voice_script, ussd_script,
|
2121
|
+
# project_script**:
|
2122
|
+
# <table>
|
2123
|
+
# <tr><td> code </td> <td> The JavaScript code to run
|
2124
|
+
# when the service is triggered (max 100 KB). To run code longer than 100 KB, use a
|
2125
|
+
# Cloud Script Module. (string) </td></tr>
|
2126
|
+
# </table>
|
2127
|
+
# <br />
|
2128
|
+
#
|
2129
|
+
# **custom_template_instance**:
|
2130
|
+
# <table>
|
2131
|
+
# <tr><td> template_service_id </td> <td> ID of the
|
2132
|
+
# service template (string). The service template must be available to the current
|
2133
|
+
# project or organization.</td></tr>
|
2134
|
+
# <tr><td> params </td> <td> Key/value pairs for all
|
2135
|
+
# service template parameters (object). If the values satisfy the validation rules
|
2136
|
+
# specified in the service template, they will also be copied to the `vars` property
|
2137
|
+
# of the service. Any values not associated with service template parameters will be
|
2138
|
+
# ignored.
|
2139
|
+
# </td></tr>
|
2140
|
+
# </table>
|
2141
|
+
# <br />
|
2142
|
+
# * Required
|
2143
|
+
#
|
2144
|
+
# - vars
|
2145
|
+
# * Custom variables and values to set for this service. Variable names may be up to
|
2146
|
+
# 32 characters in length and can contain the characters a-z, A-Z, 0-9, and _.
|
2147
|
+
# Values may be strings, numbers, or boolean (true/false).
|
2148
|
+
# String values may be up to 4096 bytes in length when encoded as UTF-8.
|
2149
|
+
# Up to 100 variables are supported per object.
|
2150
|
+
# Setting a variable to null will delete the variable.
|
2151
|
+
#
|
2152
|
+
# - active (bool)
|
2153
|
+
# * Whether the service is initially active or inactive. Inactive services are not
|
2154
|
+
# automatically triggered and cannot be invoked via the API.
|
2155
|
+
# * Default: 1
|
2156
|
+
#
|
2157
|
+
# - response_table_id
|
2158
|
+
# * ID of a data table where responses will be stored, or null to disable
|
2159
|
+
# automatically storing responses. If the response_table_id parameter is not provided,
|
2160
|
+
# a data table may automatically be created with the same name as the service if the
|
2161
|
+
# service collects responses.
|
2162
|
+
#
|
2163
|
+
# - phone_ids (array)
|
2164
|
+
# * IDs of phones (basic routes) to associate with this service, or null to associate
|
2165
|
+
# this service with all routes. Only applies for service types that handle incoming
|
2166
|
+
# messages, voice calls, or USSD sessions.
|
2167
|
+
#
|
2168
|
+
# - message_types (array)
|
2169
|
+
# * Types of messages that this service should handle. Only applies to services that
|
2170
|
+
# handle incoming messages.
|
2171
|
+
# * Allowed values: text, call, sms, mms, ussd_session, chat
|
2172
|
+
#
|
2173
|
+
# - show_action (bool)
|
2174
|
+
# * Whether to show this service in the Actions menu within the Telerivet web app when
|
2175
|
+
# the service is active. Only applies for service types that are manually triggered.
|
2176
|
+
# * Default: 1
|
2177
|
+
#
|
2178
|
+
# - contact_number_filter
|
2179
|
+
# * If contact_number_filter is `long_number`, this service will only be triggered if
|
2180
|
+
# the contact phone number has at least 7 digits (ignoring messages from shortcodes
|
2181
|
+
# and alphanumeric senders). If contact_number_filter is `all`, the service will be
|
2182
|
+
# triggered for all contact phone numbers. Only applies to services that handle
|
2183
|
+
# incoming messages.
|
2184
|
+
# * Allowed values: long_number, all
|
2185
|
+
# * Default: long_number
|
2186
|
+
#
|
2187
|
+
# - direction
|
2188
|
+
# * Determines whether the service handles incoming voice calls, outgoing voice calls,
|
2189
|
+
# or both. Only applies to services that handle voice calls.
|
2190
|
+
# * Allowed values: incoming, outgoing, both
|
2191
|
+
# * Default: both
|
2192
|
+
#
|
2193
|
+
# - priority (int)
|
2194
|
+
# * A number that determines the order that services are triggered when an event
|
2195
|
+
# occurs (e.g. when an incoming message is received). Smaller numbers are triggered
|
2196
|
+
# first. The priority is ignored for services that are triggered directly.
|
2197
|
+
#
|
2198
|
+
# - apply_mode
|
2199
|
+
# * If apply_mode is `unhandled`, the service will not be triggered if another service
|
2200
|
+
# has already handled the incoming message. If apply_mode is `always`, the service
|
2201
|
+
# will always be triggered regardless of other services. Only applies to services that
|
2202
|
+
# handle incoming messages.
|
2203
|
+
# * Allowed values: always, unhandled
|
2204
|
+
# * Default: unhandled
|
2205
|
+
#
|
2206
|
+
# Returns:
|
2207
|
+
# Telerivet::Service
|
2208
|
+
#
|
2209
|
+
def create_service(options)
|
2210
|
+
require_relative 'service'
|
2211
|
+
Service.new(@api, @api.do_request("POST", get_base_api_path() + "/services", options))
|
2212
|
+
end
|
2213
|
+
|
1749
2214
|
#
|
1750
2215
|
# Queries services within the given project.
|
1751
2216
|
#
|
@@ -1822,6 +2287,114 @@ class Project < Entity
|
|
1822
2287
|
return Service.new(@api, {'project_id' => self.id, 'id' => id}, false)
|
1823
2288
|
end
|
1824
2289
|
|
2290
|
+
#
|
2291
|
+
# Queries service log entries associated with this project.
|
2292
|
+
#
|
2293
|
+
# Note: Service logs are automatically deleted and no longer available
|
2294
|
+
# via the API after approximately one month.
|
2295
|
+
#
|
2296
|
+
# Arguments:
|
2297
|
+
# - options (Hash)
|
2298
|
+
#
|
2299
|
+
# - service_id
|
2300
|
+
# * Filter logs generated by a particular service
|
2301
|
+
#
|
2302
|
+
# - message_id
|
2303
|
+
# * Filter service logs related to a particular message
|
2304
|
+
#
|
2305
|
+
# - contact_id
|
2306
|
+
# * Filter service logs related to a particular contact. Ignored if using the
|
2307
|
+
# message_id parameter.
|
2308
|
+
#
|
2309
|
+
# - time_created (UNIX timestamp)
|
2310
|
+
# * Filter service logs by the time they were created
|
2311
|
+
# * Allowed modifiers: time_created[min], time_created[max]
|
2312
|
+
#
|
2313
|
+
# - execution_stats (bool)
|
2314
|
+
# * Show detailed execution stats for each log entry, if available.
|
2315
|
+
#
|
2316
|
+
# - sort_dir
|
2317
|
+
# * Sort the results in ascending or descending order
|
2318
|
+
# * Allowed values: asc, desc
|
2319
|
+
# * Default: asc
|
2320
|
+
#
|
2321
|
+
# - page_size (int)
|
2322
|
+
# * Number of results returned per page (max 500)
|
2323
|
+
# * Default: 50
|
2324
|
+
#
|
2325
|
+
# - offset (int)
|
2326
|
+
# * Number of items to skip from beginning of result set
|
2327
|
+
# * Default: 0
|
2328
|
+
#
|
2329
|
+
# Returns:
|
2330
|
+
# Telerivet::APICursor (of Hash)
|
2331
|
+
#
|
2332
|
+
# Returned Item Properties:
|
2333
|
+
# - time_created (UNIX timestamp)
|
2334
|
+
# * The time when the log entry was created
|
2335
|
+
#
|
2336
|
+
# - content
|
2337
|
+
# * The text logged
|
2338
|
+
#
|
2339
|
+
# - elapsed_ms (int)
|
2340
|
+
# * Elapsed time in milliseconds, if available.
|
2341
|
+
#
|
2342
|
+
# - service_id
|
2343
|
+
# * ID of the service associated with this log entry. Not returned when querying log
|
2344
|
+
# entries for a particular service.
|
2345
|
+
#
|
2346
|
+
# - message_id
|
2347
|
+
# * ID of the message associated with this log entry. Not returned when querying log
|
2348
|
+
# entries for a particular message.
|
2349
|
+
#
|
2350
|
+
# - contact_id
|
2351
|
+
# * ID of the contact associated with this log entry. Not returned when querying log
|
2352
|
+
# entries for a particular message or contact.
|
2353
|
+
#
|
2354
|
+
# - api_request_count (int)
|
2355
|
+
# * The total number of API requests triggered via the Cloud Script API. (Only
|
2356
|
+
# provided if execution_stats=true.)
|
2357
|
+
#
|
2358
|
+
# - api_request_ms (int)
|
2359
|
+
# * The total execution time of all API requests triggered via the Cloud Script API.
|
2360
|
+
# (Only provided if execution_stats=true.)
|
2361
|
+
#
|
2362
|
+
# - http_request_count (int)
|
2363
|
+
# * The total number of external HTTP requests triggered via the Cloud Script API.
|
2364
|
+
# (Only provided if execution_stats=true.)
|
2365
|
+
#
|
2366
|
+
# - http_request_ms (int)
|
2367
|
+
# * The total execution time of all external HTTP requests triggered via the Cloud
|
2368
|
+
# Script API. (Only provided if execution_stats=true.)
|
2369
|
+
#
|
2370
|
+
# - webhook_count (int)
|
2371
|
+
# * The total number of Webhook API requests triggered. (Only provided if
|
2372
|
+
# execution_stats=true.)
|
2373
|
+
#
|
2374
|
+
# - requests (array)
|
2375
|
+
# * Details about each API request, external HTTP request, and Cloud Script Module
|
2376
|
+
# loaded via the Cloud Script API. (Only provided if execution_stats=true.)
|
2377
|
+
#
|
2378
|
+
# Each item in the array has the following properties:
|
2379
|
+
#
|
2380
|
+
# - type (string): `api_request`, `http_request`, or
|
2381
|
+
# `module_load`
|
2382
|
+
# - resource (string): A string specific to the type of
|
2383
|
+
# request.
|
2384
|
+
# For module_load, this is the module path. For
|
2385
|
+
# api_request, it contains the HTTP
|
2386
|
+
# method, path, and query string. For http_request, it
|
2387
|
+
# contains the HTTP method and
|
2388
|
+
# URL.
|
2389
|
+
# - elapsed_ms (int): Number of milliseconds elapsed in
|
2390
|
+
# fetching
|
2391
|
+
# this resource
|
2392
|
+
# - status_code (int): Response status code, if available
|
2393
|
+
#
|
2394
|
+
def query_service_logs(options = nil)
|
2395
|
+
@api.cursor(nil, get_base_api_path() + "/service_logs", options)
|
2396
|
+
end
|
2397
|
+
|
1825
2398
|
#
|
1826
2399
|
# Queries custom routes that can be used to send messages (not including Phones).
|
1827
2400
|
#
|
@@ -1926,8 +2499,8 @@ class Project < Entity
|
|
1926
2499
|
#
|
1927
2500
|
# - status
|
1928
2501
|
# * Filter transactions by status
|
1929
|
-
# * Allowed values: pending, queued, processing, successful, failed,
|
1930
|
-
# pending_payment, pending_approval
|
2502
|
+
# * Allowed values: pending, queued, processing, submitted, successful, failed,
|
2503
|
+
# cancelled, pending_payment, pending_approval
|
1931
2504
|
#
|
1932
2505
|
# - sort_dir
|
1933
2506
|
# * Sort the results in ascending or descending order
|
@@ -1998,6 +2571,9 @@ class Project < Entity
|
|
1998
2571
|
#
|
1999
2572
|
# Allows customizing how a custom contact field is displayed in the Telerivet web app.
|
2000
2573
|
#
|
2574
|
+
# The variable path parameter can contain the characters a-z, A-Z,
|
2575
|
+
# 0-9, and _, and may be up to 32 characters in length.
|
2576
|
+
#
|
2001
2577
|
# Arguments:
|
2002
2578
|
# - variable
|
2003
2579
|
# * The variable name of the field to create or update.
|
@@ -2011,8 +2587,8 @@ class Project < Entity
|
|
2011
2587
|
#
|
2012
2588
|
# - type (int)
|
2013
2589
|
# * Field type
|
2014
|
-
# * Allowed values: text, long_text, phone_number, email, url, audio, date,
|
2015
|
-
# number, boolean, select
|
2590
|
+
# * Allowed values: text, long_text, secret, phone_number, email, url, audio, date,
|
2591
|
+
# date_time, number, boolean, checkbox, select, radio, route
|
2016
2592
|
#
|
2017
2593
|
# - order (int)
|
2018
2594
|
# * Order in which to display the field
|
@@ -2056,6 +2632,9 @@ class Project < Entity
|
|
2056
2632
|
#
|
2057
2633
|
# Allows customizing how a custom message field is displayed in the Telerivet web app.
|
2058
2634
|
#
|
2635
|
+
# The variable path parameter can contain the characters a-z, A-Z,
|
2636
|
+
# 0-9, and _, and may be up to 32 characters in length.
|
2637
|
+
#
|
2059
2638
|
# Arguments:
|
2060
2639
|
# - variable
|
2061
2640
|
# * The variable name of the field to create or update.
|
@@ -2069,8 +2648,8 @@ class Project < Entity
|
|
2069
2648
|
#
|
2070
2649
|
# - type (string)
|
2071
2650
|
# * Field type
|
2072
|
-
# * Allowed values: text, long_text, phone_number, email, url, audio, date,
|
2073
|
-
# number, boolean, select
|
2651
|
+
# * Allowed values: text, long_text, secret, phone_number, email, url, audio, date,
|
2652
|
+
# date_time, number, boolean, checkbox, select, radio, route
|
2074
2653
|
#
|
2075
2654
|
# - order (int)
|
2076
2655
|
# * Order in which to display the field
|
@@ -2194,10 +2773,34 @@ class Project < Entity
|
|
2194
2773
|
get('timezone_id')
|
2195
2774
|
end
|
2196
2775
|
|
2776
|
+
def timezone_id=(value)
|
2777
|
+
set('timezone_id', value)
|
2778
|
+
end
|
2779
|
+
|
2197
2780
|
def url_slug
|
2198
2781
|
get('url_slug')
|
2199
2782
|
end
|
2200
2783
|
|
2784
|
+
def url_slug=(value)
|
2785
|
+
set('url_slug', value)
|
2786
|
+
end
|
2787
|
+
|
2788
|
+
def default_route_id
|
2789
|
+
get('default_route_id')
|
2790
|
+
end
|
2791
|
+
|
2792
|
+
def default_route_id=(value)
|
2793
|
+
set('default_route_id', value)
|
2794
|
+
end
|
2795
|
+
|
2796
|
+
def auto_create_contacts
|
2797
|
+
get('auto_create_contacts')
|
2798
|
+
end
|
2799
|
+
|
2800
|
+
def auto_create_contacts=(value)
|
2801
|
+
set('auto_create_contacts', value)
|
2802
|
+
end
|
2803
|
+
|
2201
2804
|
def organization_id
|
2202
2805
|
get('organization_id')
|
2203
2806
|
end
|