Class: Telerivet::ScheduledMessage
- Defined in:
- lib/telerivet/scheduledmessage.rb
Overview
Represents a scheduled message within Telerivet.
Fields:
- id (string, max 34 characters)
* ID of the scheduled message
* Read-only
- content
* Text content of the scheduled message
* Updatable via API
- rrule
* Recurrence rule for recurring scheduled messages, e.g. 'FREQ=MONTHLY' or
'FREQ=WEEKLY;INTERVAL=2'; see
[RFC2445](https://tools.ietf.org/html/rfc2445#section-4.3.10).
* Updatable via API
- timezone_id
* Timezone ID used to compute times for recurring messages; see [List of tz database
time zones Wikipedia
article](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
* Updatable via API
- recipients (array of objects)
* List of recipients. Each recipient is an object with a string `type` property, which
may be `"phone_number"`, `"group"`, or `"filter"`.
If the type is `"phone_number"`, the `phone_number` property will
be set to the recipient's phone number.
If the type is `"group"`, the `group_id` property will be set to
the ID of the group, and the `group_name` property will be set to the name of the
group.
If the type is `"filter"`, the `filter_type` property (string) and
`filter_params` property (object) describe the filter used to send the broadcast. (API
clients should not rely on a particular value or format of the `filter_type` or
`filter_params` properties, as they may change without notice.)
* Read-only
- recipients_str
* A string with a human readable description of the first few recipients (possibly
truncated)
* Read-only
- group_id
* ID of the group to send the message to (null if the recipient is an individual
contact, or if there are multiple recipients)
* Updatable via API
- contact_id
* ID of the contact to send the message to (null if the recipient is a group, or if
there are multiple recipients)
* Updatable via API
- to_number
* Phone number to send the message to (null if the recipient is a group, or if there
are multiple recipients)
* Updatable via API
- route_id
* ID of the phone or route the message will be sent from
* Updatable via API
- service_id (string, max 34 characters)
* The service associated with this message (for voice calls, the service defines the
call flow)
* Updatable via API
- audio_url
* For voice calls, the URL of an MP3 file to play when the contact answers the call
* Updatable via API
- tts_lang
* For voice calls, the language of the text-to-speech voice
* Allowed values: en-US, en-GB, en-GB-WLS, en-AU, en-IN, da-DK, nl-NL, fr-FR, fr-CA,
de-DE, is-IS, it-IT, pl-PL, pt-BR, pt-PT, ru-RU, es-ES, es-US, sv-SE
* Updatable via API
- tts_voice
* For voice calls, the text-to-speech voice
* Allowed values: female, male
* Updatable via API
- message_type
* Type of scheduled message
* Allowed values: sms, mms, ussd, ussd_session, call, chat, service
* Read-only
- time_created (UNIX timestamp)
* Time the scheduled message was created in Telerivet
* Read-only
- start_time (UNIX timestamp)
* The time that the message will be sent (or first sent for recurring messages)
* Updatable via API
- end_time (UNIX timestamp)
* Time after which a recurring message will stop (not applicable to non-recurring
scheduled messages)
* Updatable via API
- prev_time (UNIX timestamp)
* The most recent time that Telerivet has sent this scheduled message (null if it has
never been sent)
* Read-only
- next_time (UNIX timestamp)
* The next upcoming time that Telerivet will sent this scheduled message (null if it
will not be sent again)
* Read-only
- occurrences (int)
* Number of times this scheduled message has already been sent
* Read-only
- replace_variables (bool)
* Set to true if Telerivet will render variables like [[contact.name]] in the message
content, false otherwise
* Updatable via API
- track_clicks (boolean)
* If true, URLs in the message content will automatically be replaced with unique
short URLs
* Updatable via API
- media (array)
* Array of media attachments for the text message. This property is undefined for
messages that do not contain media files.
* Updatable via API
- route_params (Hash)
* Route-specific parameters to use when sending the message.
When sending messages via chat apps such as WhatsApp, the route_params
parameter can be used to send messages with app-specific features such as quick
replies and link buttons.
For more details, see [Route-Specific Parameters](#route_params).
* Updatable via API
- vars (Hash)
* Custom variables stored for this scheduled message (copied to Message when sent).
Variable names may be up to 32 characters in length and can contain the characters
a-z, A-Z, 0-9, and _.
Values may be strings, numbers, or boolean (true/false).
String values may be up to 4096 bytes in length when encoded as UTF-8.
Up to 100 variables are supported per object.
Setting a variable to null will delete the variable.
* Updatable via API
- label_ids (array)
* IDs of labels to add to the Message
* Updatable via API
- relative_scheduled_id
* ID of the relative scheduled message this scheduled message was created from, if
applicable
* Read-only
- project_id
* ID of the project this scheduled message belongs to
* Read-only
- is_template (bool)
* Set to true if Telerivet will render variables like [[contact.name]] in the message
content
* Read-only
Instance Method Summary collapse
- #audio_url ⇒ Object
- #audio_url=(value) ⇒ Object
- #contact_id ⇒ Object
- #contact_id=(value) ⇒ Object
- #content ⇒ Object
- #content=(value) ⇒ Object
-
#delete ⇒ Object
Cancels this scheduled message.
- #end_time ⇒ Object
- #end_time=(value) ⇒ Object
- #get_base_api_path ⇒ Object
- #group_id ⇒ Object
- #group_id=(value) ⇒ Object
- #id ⇒ Object
- #is_template ⇒ Object
- #label_ids ⇒ Object
- #label_ids=(value) ⇒ Object
- #media ⇒ Object
- #media=(value) ⇒ Object
- #message_type ⇒ Object
- #next_time ⇒ Object
- #occurrences ⇒ Object
- #prev_time ⇒ Object
- #project_id ⇒ Object
- #recipients ⇒ Object
- #recipients_str ⇒ Object
- #relative_scheduled_id ⇒ Object
- #replace_variables ⇒ Object
- #replace_variables=(value) ⇒ Object
- #route_id ⇒ Object
- #route_id=(value) ⇒ Object
- #route_params ⇒ Object
- #route_params=(value) ⇒ Object
- #rrule ⇒ Object
- #rrule=(value) ⇒ Object
-
#save ⇒ Object
Saves any fields or custom variables that have changed for this scheduled message.
- #service_id ⇒ Object
- #service_id=(value) ⇒ Object
- #start_time ⇒ Object
- #start_time=(value) ⇒ Object
- #time_created ⇒ Object
- #timezone_id ⇒ Object
- #timezone_id=(value) ⇒ Object
- #to_number ⇒ Object
- #to_number=(value) ⇒ Object
- #track_clicks ⇒ Object
- #track_clicks=(value) ⇒ Object
- #tts_lang ⇒ Object
- #tts_lang=(value) ⇒ Object
- #tts_voice ⇒ Object
- #tts_voice=(value) ⇒ Object
Methods inherited from Entity
#get, #initialize, #load, #set, #set_data, #to_s, #vars
Constructor Details
This class inherits a constructor from Telerivet::Entity
Instance Method Details
#audio_url ⇒ Object
266 267 268 |
# File 'lib/telerivet/scheduledmessage.rb', line 266 def audio_url get('audio_url') end |
#audio_url=(value) ⇒ Object
270 271 272 |
# File 'lib/telerivet/scheduledmessage.rb', line 270 def audio_url=(value) set('audio_url', value) end |
#contact_id ⇒ Object
234 235 236 |
# File 'lib/telerivet/scheduledmessage.rb', line 234 def contact_id get('contact_id') end |
#contact_id=(value) ⇒ Object
238 239 240 |
# File 'lib/telerivet/scheduledmessage.rb', line 238 def contact_id=(value) set('contact_id', value) end |
#content ⇒ Object
194 195 196 |
# File 'lib/telerivet/scheduledmessage.rb', line 194 def content get('content') end |
#content=(value) ⇒ Object
198 199 200 |
# File 'lib/telerivet/scheduledmessage.rb', line 198 def content=(value) set('content', value) end |
#delete ⇒ Object
Cancels this scheduled message.
186 187 188 |
# File 'lib/telerivet/scheduledmessage.rb', line 186 def delete() @api.do_request("DELETE", get_base_api_path()) end |
#end_time ⇒ Object
306 307 308 |
# File 'lib/telerivet/scheduledmessage.rb', line 306 def end_time get('end_time') end |
#end_time=(value) ⇒ Object
310 311 312 |
# File 'lib/telerivet/scheduledmessage.rb', line 310 def end_time=(value) set('end_time', value) end |
#get_base_api_path ⇒ Object
378 379 380 |
# File 'lib/telerivet/scheduledmessage.rb', line 378 def get_base_api_path() "/projects/#{get('project_id')}/scheduled/#{get('id')}" end |
#group_id ⇒ Object
226 227 228 |
# File 'lib/telerivet/scheduledmessage.rb', line 226 def group_id get('group_id') end |
#group_id=(value) ⇒ Object
230 231 232 |
# File 'lib/telerivet/scheduledmessage.rb', line 230 def group_id=(value) set('group_id', value) end |
#id ⇒ Object
190 191 192 |
# File 'lib/telerivet/scheduledmessage.rb', line 190 def id get('id') end |
#is_template ⇒ Object
374 375 376 |
# File 'lib/telerivet/scheduledmessage.rb', line 374 def is_template get('is_template') end |
#label_ids ⇒ Object
358 359 360 |
# File 'lib/telerivet/scheduledmessage.rb', line 358 def label_ids get('label_ids') end |
#label_ids=(value) ⇒ Object
362 363 364 |
# File 'lib/telerivet/scheduledmessage.rb', line 362 def label_ids=(value) set('label_ids', value) end |
#media ⇒ Object
342 343 344 |
# File 'lib/telerivet/scheduledmessage.rb', line 342 def media get('media') end |
#media=(value) ⇒ Object
346 347 348 |
# File 'lib/telerivet/scheduledmessage.rb', line 346 def media=(value) set('media', value) end |
#message_type ⇒ Object
290 291 292 |
# File 'lib/telerivet/scheduledmessage.rb', line 290 def get('message_type') end |
#next_time ⇒ Object
318 319 320 |
# File 'lib/telerivet/scheduledmessage.rb', line 318 def next_time get('next_time') end |
#occurrences ⇒ Object
322 323 324 |
# File 'lib/telerivet/scheduledmessage.rb', line 322 def occurrences get('occurrences') end |
#prev_time ⇒ Object
314 315 316 |
# File 'lib/telerivet/scheduledmessage.rb', line 314 def prev_time get('prev_time') end |
#project_id ⇒ Object
370 371 372 |
# File 'lib/telerivet/scheduledmessage.rb', line 370 def project_id get('project_id') end |
#recipients ⇒ Object
218 219 220 |
# File 'lib/telerivet/scheduledmessage.rb', line 218 def recipients get('recipients') end |
#recipients_str ⇒ Object
222 223 224 |
# File 'lib/telerivet/scheduledmessage.rb', line 222 def recipients_str get('recipients_str') end |
#relative_scheduled_id ⇒ Object
366 367 368 |
# File 'lib/telerivet/scheduledmessage.rb', line 366 def relative_scheduled_id get('relative_scheduled_id') end |
#replace_variables ⇒ Object
326 327 328 |
# File 'lib/telerivet/scheduledmessage.rb', line 326 def replace_variables get('replace_variables') end |
#replace_variables=(value) ⇒ Object
330 331 332 |
# File 'lib/telerivet/scheduledmessage.rb', line 330 def replace_variables=(value) set('replace_variables', value) end |
#route_id ⇒ Object
250 251 252 |
# File 'lib/telerivet/scheduledmessage.rb', line 250 def route_id get('route_id') end |
#route_id=(value) ⇒ Object
254 255 256 |
# File 'lib/telerivet/scheduledmessage.rb', line 254 def route_id=(value) set('route_id', value) end |
#route_params ⇒ Object
350 351 352 |
# File 'lib/telerivet/scheduledmessage.rb', line 350 def route_params get('route_params') end |
#route_params=(value) ⇒ Object
354 355 356 |
# File 'lib/telerivet/scheduledmessage.rb', line 354 def route_params=(value) set('route_params', value) end |
#rrule ⇒ Object
202 203 204 |
# File 'lib/telerivet/scheduledmessage.rb', line 202 def rrule get('rrule') end |
#rrule=(value) ⇒ Object
206 207 208 |
# File 'lib/telerivet/scheduledmessage.rb', line 206 def rrule=(value) set('rrule', value) end |
#save ⇒ Object
Saves any fields or custom variables that have changed for this scheduled message.
179 180 181 |
# File 'lib/telerivet/scheduledmessage.rb', line 179 def save() super end |
#service_id ⇒ Object
258 259 260 |
# File 'lib/telerivet/scheduledmessage.rb', line 258 def service_id get('service_id') end |
#service_id=(value) ⇒ Object
262 263 264 |
# File 'lib/telerivet/scheduledmessage.rb', line 262 def service_id=(value) set('service_id', value) end |
#start_time ⇒ Object
298 299 300 |
# File 'lib/telerivet/scheduledmessage.rb', line 298 def start_time get('start_time') end |
#start_time=(value) ⇒ Object
302 303 304 |
# File 'lib/telerivet/scheduledmessage.rb', line 302 def start_time=(value) set('start_time', value) end |
#time_created ⇒ Object
294 295 296 |
# File 'lib/telerivet/scheduledmessage.rb', line 294 def time_created get('time_created') end |
#timezone_id ⇒ Object
210 211 212 |
# File 'lib/telerivet/scheduledmessage.rb', line 210 def timezone_id get('timezone_id') end |
#timezone_id=(value) ⇒ Object
214 215 216 |
# File 'lib/telerivet/scheduledmessage.rb', line 214 def timezone_id=(value) set('timezone_id', value) end |
#to_number ⇒ Object
242 243 244 |
# File 'lib/telerivet/scheduledmessage.rb', line 242 def to_number get('to_number') end |
#to_number=(value) ⇒ Object
246 247 248 |
# File 'lib/telerivet/scheduledmessage.rb', line 246 def to_number=(value) set('to_number', value) end |
#track_clicks ⇒ Object
334 335 336 |
# File 'lib/telerivet/scheduledmessage.rb', line 334 def track_clicks get('track_clicks') end |
#track_clicks=(value) ⇒ Object
338 339 340 |
# File 'lib/telerivet/scheduledmessage.rb', line 338 def track_clicks=(value) set('track_clicks', value) end |
#tts_lang ⇒ Object
274 275 276 |
# File 'lib/telerivet/scheduledmessage.rb', line 274 def tts_lang get('tts_lang') end |
#tts_lang=(value) ⇒ Object
278 279 280 |
# File 'lib/telerivet/scheduledmessage.rb', line 278 def tts_lang=(value) set('tts_lang', value) end |
#tts_voice ⇒ Object
282 283 284 |
# File 'lib/telerivet/scheduledmessage.rb', line 282 def tts_voice get('tts_voice') end |
#tts_voice=(value) ⇒ Object
286 287 288 |
# File 'lib/telerivet/scheduledmessage.rb', line 286 def tts_voice=(value) set('tts_voice', value) end |