Class: Telerivet::RelativeScheduledMessage

Inherits:
Entity
  • Object
show all
Defined in:
lib/telerivet/relativescheduledmessage.rb

Overview

A relative scheduled message is a message that is scheduled relative to a date stored as a custom field for each recipient contact. This allows scheduling messages on a different date for each contact, for example on their birthday, a certain number of days before an appointment, or a certain number of days after enrolling in a campaign.

Telerivet will automatically create a ScheduledMessage for each contact matching a RelativeScheduledMessage.

Any service that can be manually triggered for a contact (including polls) may also be scheduled via a relative scheduled message, whether or not the service actually sends a message.

Fields:

- id (string, max 34 characters)
  * ID of the relative scheduled message
  * Read-only

- content
  * Text content of the relative scheduled message
  * Updatable via API

- time_of_day
  * Time of day when scheduled messages will be sent in HH:MM format (with hours from 00
      to 23)
  * Updatable via API

- date_variable
  * Custom contact variable storing date or date/time values relative to which messages
      will be scheduled.
  * Updatable via API

- offset_scale
  * The type of interval that will be used to adjust the scheduled date relative to the
      date stored in the contact's date_variable, when offset_count is non-zero (I=minutes,
      D=day, W=week, M=month, Y=year)
  * Allowed values: I, D, W, M, Y
  * Updatable via API

- offset_count (int)
  * The number of days/weeks/months/years to adjust the date of the scheduled message
      relative relative to the date stored in the contact's date_variable. May be positive,
      negative, or zero.
  * 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

- end_time (UNIX timestamp)
  * Time after which recurring messages will stop (not applicable to non-recurring
      scheduled messages)
  * 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_str
  * A string with a human readable description of the recipient
  * Read-only

- group_id
  * ID of the group to send the message to (null if the recipient is an individual
      contact)
  * Updatable via API

- contact_id
  * ID of the contact to send the message to (null if the recipient is a group)
  * Updatable via API

- to_number
  * Phone number to send the message to (null if the recipient is a group)
  * 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 relative scheduled message was created in Telerivet
  * 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 each ScheduledMessage
      and 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

- project_id
  * ID of the project this relative scheduled message belongs to
  * Read-only

Instance Method Summary collapse

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_urlObject



288
289
290
# File 'lib/telerivet/relativescheduledmessage.rb', line 288

def audio_url
    get('audio_url')
end

#audio_url=(value) ⇒ Object



292
293
294
# File 'lib/telerivet/relativescheduledmessage.rb', line 292

def audio_url=(value)
    set('audio_url', value)
end

#contact_idObject



256
257
258
# File 'lib/telerivet/relativescheduledmessage.rb', line 256

def contact_id
    get('contact_id')
end

#contact_id=(value) ⇒ Object



260
261
262
# File 'lib/telerivet/relativescheduledmessage.rb', line 260

def contact_id=(value)
    set('contact_id', value)
end

#contentObject



180
181
182
# File 'lib/telerivet/relativescheduledmessage.rb', line 180

def content
    get('content')
end

#content=(value) ⇒ Object



184
185
186
# File 'lib/telerivet/relativescheduledmessage.rb', line 184

def content=(value)
    set('content', value)
end

#date_variableObject



196
197
198
# File 'lib/telerivet/relativescheduledmessage.rb', line 196

def date_variable
    get('date_variable')
end

#date_variable=(value) ⇒ Object



200
201
202
# File 'lib/telerivet/relativescheduledmessage.rb', line 200

def date_variable=(value)
    set('date_variable', value)
end

#deleteObject

Deletes this relative scheduled message and any associated scheduled messages.



172
173
174
# File 'lib/telerivet/relativescheduledmessage.rb', line 172

def delete()
    @api.do_request("DELETE", get_base_api_path())
end

#end_timeObject



228
229
230
# File 'lib/telerivet/relativescheduledmessage.rb', line 228

def end_time
    get('end_time')
end

#end_time=(value) ⇒ Object



232
233
234
# File 'lib/telerivet/relativescheduledmessage.rb', line 232

def end_time=(value)
    set('end_time', value)
end

#get_base_api_pathObject



364
365
366
# File 'lib/telerivet/relativescheduledmessage.rb', line 364

def get_base_api_path()
    "/projects/#{get('project_id')}/relative_scheduled/#{get('id')}"
end

#group_idObject



248
249
250
# File 'lib/telerivet/relativescheduledmessage.rb', line 248

def group_id
    get('group_id')
end

#group_id=(value) ⇒ Object



252
253
254
# File 'lib/telerivet/relativescheduledmessage.rb', line 252

def group_id=(value)
    set('group_id', value)
end

#idObject



176
177
178
# File 'lib/telerivet/relativescheduledmessage.rb', line 176

def id
    get('id')
end

#label_idsObject



352
353
354
# File 'lib/telerivet/relativescheduledmessage.rb', line 352

def label_ids
    get('label_ids')
end

#label_ids=(value) ⇒ Object



356
357
358
# File 'lib/telerivet/relativescheduledmessage.rb', line 356

def label_ids=(value)
    set('label_ids', value)
end

#mediaObject



336
337
338
# File 'lib/telerivet/relativescheduledmessage.rb', line 336

def media
    get('media')
end

#media=(value) ⇒ Object



340
341
342
# File 'lib/telerivet/relativescheduledmessage.rb', line 340

def media=(value)
    set('media', value)
end

#message_typeObject



312
313
314
# File 'lib/telerivet/relativescheduledmessage.rb', line 312

def message_type
    get('message_type')
end

#offset_countObject



212
213
214
# File 'lib/telerivet/relativescheduledmessage.rb', line 212

def offset_count
    get('offset_count')
end

#offset_count=(value) ⇒ Object



216
217
218
# File 'lib/telerivet/relativescheduledmessage.rb', line 216

def offset_count=(value)
    set('offset_count', value)
end

#offset_scaleObject



204
205
206
# File 'lib/telerivet/relativescheduledmessage.rb', line 204

def offset_scale
    get('offset_scale')
end

#offset_scale=(value) ⇒ Object



208
209
210
# File 'lib/telerivet/relativescheduledmessage.rb', line 208

def offset_scale=(value)
    set('offset_scale', value)
end

#project_idObject



360
361
362
# File 'lib/telerivet/relativescheduledmessage.rb', line 360

def project_id
    get('project_id')
end

#recipients_strObject



244
245
246
# File 'lib/telerivet/relativescheduledmessage.rb', line 244

def recipients_str
    get('recipients_str')
end

#replace_variablesObject



320
321
322
# File 'lib/telerivet/relativescheduledmessage.rb', line 320

def replace_variables
    get('replace_variables')
end

#replace_variables=(value) ⇒ Object



324
325
326
# File 'lib/telerivet/relativescheduledmessage.rb', line 324

def replace_variables=(value)
    set('replace_variables', value)
end

#route_idObject



272
273
274
# File 'lib/telerivet/relativescheduledmessage.rb', line 272

def route_id
    get('route_id')
end

#route_id=(value) ⇒ Object



276
277
278
# File 'lib/telerivet/relativescheduledmessage.rb', line 276

def route_id=(value)
    set('route_id', value)
end

#route_paramsObject



344
345
346
# File 'lib/telerivet/relativescheduledmessage.rb', line 344

def route_params
    get('route_params')
end

#route_params=(value) ⇒ Object



348
349
350
# File 'lib/telerivet/relativescheduledmessage.rb', line 348

def route_params=(value)
    set('route_params', value)
end

#rruleObject



220
221
222
# File 'lib/telerivet/relativescheduledmessage.rb', line 220

def rrule
    get('rrule')
end

#rrule=(value) ⇒ Object



224
225
226
# File 'lib/telerivet/relativescheduledmessage.rb', line 224

def rrule=(value)
    set('rrule', value)
end

#saveObject

Saves any fields or custom variables that have changed for this relative scheduled message.



165
166
167
# File 'lib/telerivet/relativescheduledmessage.rb', line 165

def save()
    super
end

#service_idObject



280
281
282
# File 'lib/telerivet/relativescheduledmessage.rb', line 280

def service_id
    get('service_id')
end

#service_id=(value) ⇒ Object



284
285
286
# File 'lib/telerivet/relativescheduledmessage.rb', line 284

def service_id=(value)
    set('service_id', value)
end

#time_createdObject



316
317
318
# File 'lib/telerivet/relativescheduledmessage.rb', line 316

def time_created
    get('time_created')
end

#time_of_dayObject



188
189
190
# File 'lib/telerivet/relativescheduledmessage.rb', line 188

def time_of_day
    get('time_of_day')
end

#time_of_day=(value) ⇒ Object



192
193
194
# File 'lib/telerivet/relativescheduledmessage.rb', line 192

def time_of_day=(value)
    set('time_of_day', value)
end

#timezone_idObject



236
237
238
# File 'lib/telerivet/relativescheduledmessage.rb', line 236

def timezone_id
    get('timezone_id')
end

#timezone_id=(value) ⇒ Object



240
241
242
# File 'lib/telerivet/relativescheduledmessage.rb', line 240

def timezone_id=(value)
    set('timezone_id', value)
end

#to_numberObject



264
265
266
# File 'lib/telerivet/relativescheduledmessage.rb', line 264

def to_number
    get('to_number')
end

#to_number=(value) ⇒ Object



268
269
270
# File 'lib/telerivet/relativescheduledmessage.rb', line 268

def to_number=(value)
    set('to_number', value)
end

#track_clicksObject



328
329
330
# File 'lib/telerivet/relativescheduledmessage.rb', line 328

def track_clicks
    get('track_clicks')
end

#track_clicks=(value) ⇒ Object



332
333
334
# File 'lib/telerivet/relativescheduledmessage.rb', line 332

def track_clicks=(value)
    set('track_clicks', value)
end

#tts_langObject



296
297
298
# File 'lib/telerivet/relativescheduledmessage.rb', line 296

def tts_lang
    get('tts_lang')
end

#tts_lang=(value) ⇒ Object



300
301
302
# File 'lib/telerivet/relativescheduledmessage.rb', line 300

def tts_lang=(value)
    set('tts_lang', value)
end

#tts_voiceObject



304
305
306
# File 'lib/telerivet/relativescheduledmessage.rb', line 304

def tts_voice
    get('tts_voice')
end

#tts_voice=(value) ⇒ Object



308
309
310
# File 'lib/telerivet/relativescheduledmessage.rb', line 308

def tts_voice=(value)
    set('tts_voice', value)
end