class Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::WebhookInstance
Public Class Methods
Initialize the WebhookInstance
@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 webhook.
@param [String] sid A 34 character string that uniquely identifies this
resource.
@return [WebhookInstance] WebhookInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 298 def initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil) 299 super(version) 300 301 # Marshaled Properties 302 @properties = { 303 'sid' => payload['sid'], 304 'account_sid' => payload['account_sid'], 305 'chat_service_sid' => payload['chat_service_sid'], 306 'conversation_sid' => payload['conversation_sid'], 307 'target' => payload['target'], 308 'url' => payload['url'], 309 'configuration' => payload['configuration'], 310 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 311 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 312 } 313 314 # Context 315 @instance_context = nil 316 @params = { 317 'chat_service_sid' => chat_service_sid, 318 'conversation_sid' => conversation_sid, 319 'sid' => sid || @properties['sid'], 320 } 321 end
Public Instance Methods
@return [String] The unique ID of the Account responsible for this conversation.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 347 def account_sid 348 @properties['account_sid'] 349 end
@return [String] The SID of the Conversation Service that the resource is associated with.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 353 def chat_service_sid 354 @properties['chat_service_sid'] 355 end
@return [Hash] The configuration of this webhook.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 377 def configuration 378 @properties['configuration'] 379 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 [WebhookContext] WebhookContext
for this WebhookInstance
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 327 def context 328 unless @instance_context 329 @instance_context = WebhookContext.new( 330 @version, 331 @params['chat_service_sid'], 332 @params['conversation_sid'], 333 @params['sid'], 334 ) 335 end 336 @instance_context 337 end
@return [String] The unique ID of the Conversation for this webhook.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 359 def conversation_sid 360 @properties['conversation_sid'] 361 end
@return [Time] The date that this resource was created.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 383 def date_created 384 @properties['date_created'] 385 end
@return [Time] The date that this resource was last updated.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 389 def date_updated 390 @properties['date_updated'] 391 end
Delete the WebhookInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 419 def delete 420 context.delete 421 end
Fetch the WebhookInstance
@return [WebhookInstance] Fetched WebhookInstance
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 426 def fetch 427 context.fetch 428 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 439 def inspect 440 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 441 "<Twilio.Conversations.V1.WebhookInstance #{values}>" 442 end
@return [String] A 34 character string that uniquely identifies this resource.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 341 def sid 342 @properties['sid'] 343 end
@return [String] The target of this webhook.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 365 def target 366 @properties['target'] 367 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 432 def to_s 433 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 434 "<Twilio.Conversations.V1.WebhookInstance #{values}>" 435 end
Update the WebhookInstance
@param [String] configuration_url The absolute url the webhook request should be
sent to.
@param [webhook.Method] configuration_method The HTTP
method to be used when
sending a webhook request.
@param [Array] configuration_filters The list of events, firing webhook
event for this Conversation.
@param [Array] configuration_triggers The list of keywords, firing
webhook event for this Conversation.
@param [String] configuration_flow_sid The studio flow SID, where the webhook
should be sent to.
@return [WebhookInstance] Updated WebhookInstance
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 406 def update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset) 407 context.update( 408 configuration_url: configuration_url, 409 configuration_method: configuration_method, 410 configuration_filters: configuration_filters, 411 configuration_triggers: configuration_triggers, 412 configuration_flow_sid: configuration_flow_sid, 413 ) 414 end
@return [String] An absolute URL for this webhook.
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 371 def url 372 @properties['url'] 373 end