class Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::MessageInstance

Public Class Methods

new(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil) click to toggle source

Initialize the MessageInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] chat_service_sid The SID of the {Conversation

Service}[https://www.twilio.com/docs/conversations/api/service-resource] the
Participant resource is associated with.

@param [String] conversation_sid The unique ID of the

{Conversation}[https://www.twilio.com/docs/conversations/api/conversation-resource]
for this message.

@param [String] sid A 34 character string that uniquely identifies this

resource.

@return [MessageInstance] MessageInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
343 def initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil)
344   super(version)
345 
346   # Marshaled Properties
347   @properties = {
348       'account_sid' => payload['account_sid'],
349       'chat_service_sid' => payload['chat_service_sid'],
350       'conversation_sid' => payload['conversation_sid'],
351       'sid' => payload['sid'],
352       'index' => payload['index'].to_i,
353       'author' => payload['author'],
354       'body' => payload['body'],
355       'media' => payload['media'],
356       'attributes' => payload['attributes'],
357       'participant_sid' => payload['participant_sid'],
358       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
359       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
360       'delivery' => payload['delivery'],
361       'url' => payload['url'],
362       'links' => payload['links'],
363   }
364 
365   # Context
366   @instance_context = nil
367   @params = {
368       'chat_service_sid' => chat_service_sid,
369       'conversation_sid' => conversation_sid,
370       'sid' => sid || @properties['sid'],
371   }
372 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The unique ID of the Account responsible for this message.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
392 def account_sid
393   @properties['account_sid']
394 end
attributes() click to toggle source

@return [String] A string metadata field you can use to store any data you wish.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
440 def attributes
441   @properties['attributes']
442 end
author() click to toggle source

@return [String] The channel specific identifier of the message's author.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
422 def author
423   @properties['author']
424 end
body() click to toggle source

@return [String] The content of the message.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
428 def body
429   @properties['body']
430 end
chat_service_sid() click to toggle source

@return [String] The SID of the Conversation Service that the resource is associated with.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
398 def chat_service_sid
399   @properties['chat_service_sid']
400 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [MessageContext] MessageContext for this MessageInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
378 def context
379   unless @instance_context
380     @instance_context = MessageContext.new(
381         @version,
382         @params['chat_service_sid'],
383         @params['conversation_sid'],
384         @params['sid'],
385     )
386   end
387   @instance_context
388 end
conversation_sid() click to toggle source

@return [String] The unique ID of the Conversation for this message.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
404 def conversation_sid
405   @properties['conversation_sid']
406 end
date_created() click to toggle source

@return [Time] The date that this resource was created.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
452 def date_created
453   @properties['date_created']
454 end
date_updated() click to toggle source

@return [Time] The date that this resource was last updated.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
458 def date_updated
459   @properties['date_updated']
460 end
delete(x_twilio_webhook_enabled: :unset) click to toggle source

Delete the MessageInstance @param [message.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
511 def delete(x_twilio_webhook_enabled: :unset)
512   context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, )
513 end
delivery() click to toggle source

@return [Hash] An object that contains the summary of delivery statuses for the message to non-chat participants.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
464 def delivery
465   @properties['delivery']
466 end
delivery_receipts() click to toggle source

Access the delivery_receipts @return [delivery_receipts] delivery_receipts

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
525 def delivery_receipts
526   context.delivery_receipts
527 end
fetch() click to toggle source

Fetch the MessageInstance @return [MessageInstance] Fetched MessageInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
518 def fetch
519   context.fetch
520 end
index() click to toggle source

@return [String] The index of the message within the Conversation.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
416 def index
417   @properties['index']
418 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
538 def inspect
539   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
540   "<Twilio.Conversations.V1.MessageInstance #{values}>"
541 end
media() click to toggle source

@return [Array] An array of objects that describe the Message's media if attached, otherwise, null.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
434 def media
435   @properties['media']
436 end
participant_sid() click to toggle source

@return [String] The unique ID of messages's author participant.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
446 def participant_sid
447   @properties['participant_sid']
448 end
sid() click to toggle source

@return [String] A 34 character string that uniquely identifies this resource.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
410 def sid
411   @properties['sid']
412 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
531 def to_s
532   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
533   "<Twilio.Conversations.V1.MessageInstance #{values}>"
534 end
update(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, x_twilio_webhook_enabled: :unset) click to toggle source

Update the MessageInstance @param [String] author The channel specific identifier of the message's author.

Defaults to `system`.

@param [String] body The content of the message, can be up to 1,600 characters

long.

@param [Time] date_created The date that this resource was created. @param [Time] date_updated The date that this resource was last updated. `null`

if the message has not been edited.

@param [String] attributes A string metadata field you can use to store any data

you wish. The string value must contain structurally valid JSON if specified.
**Note** that if the attributes are not set "{}" will be returned.

@param [message.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [MessageInstance] Updated MessageInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
495 def update(author: :unset, body: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, x_twilio_webhook_enabled: :unset)
496   context.update(
497       author: author,
498       body: body,
499       date_created: date_created,
500       date_updated: date_updated,
501       attributes: attributes,
502       x_twilio_webhook_enabled: x_twilio_webhook_enabled,
503   )
504 end
url() click to toggle source

@return [String] An absolute URL for this message.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb
470 def url
471   @properties['url']
472 end