class Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::MessageInstance
Public Class Methods
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
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
@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
@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
@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
@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
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
@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
@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
@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 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
@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
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 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
@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
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
@return [String] Absolute URL to access the receipts of this message.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb 476 def links 477 @properties['links'] 478 end
@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
@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
@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
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 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
@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