class Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::WebhookContext
Public Class Methods
Initialize the WebhookContext
@param [Version] version Version
that contains the resource @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 [WebhookContext] WebhookContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 206 def initialize(version, chat_service_sid, conversation_sid, sid) 207 super(version) 208 209 # Path Solution 210 @solution = {chat_service_sid: chat_service_sid, conversation_sid: conversation_sid, sid: sid, } 211 @uri = "/Services/#{@solution[:chat_service_sid]}/Conversations/#{@solution[:conversation_sid]}/Webhooks/#{@solution[:sid]}" 212 end
Public Instance Methods
Delete the WebhookInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 250 def delete 251 @version.delete('DELETE', @uri) 252 end
Fetch the WebhookInstance
@return [WebhookInstance] Fetched WebhookInstance
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 257 def fetch 258 payload = @version.fetch('GET', @uri) 259 260 WebhookInstance.new( 261 @version, 262 payload, 263 chat_service_sid: @solution[:chat_service_sid], 264 conversation_sid: @solution[:conversation_sid], 265 sid: @solution[:sid], 266 ) 267 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 278 def inspect 279 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 280 "#<Twilio.Conversations.V1.WebhookContext #{context}>" 281 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb 271 def to_s 272 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 273 "#<Twilio.Conversations.V1.WebhookContext #{context}>" 274 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 227 def update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset) 228 data = Twilio::Values.of({ 229 'Configuration.Url' => configuration_url, 230 'Configuration.Method' => configuration_method, 231 'Configuration.Filters' => Twilio.serialize_list(configuration_filters) { |e| e }, 232 'Configuration.Triggers' => Twilio.serialize_list(configuration_triggers) { |e| e }, 233 'Configuration.FlowSid' => configuration_flow_sid, 234 }) 235 236 payload = @version.update('POST', @uri, data: data) 237 238 WebhookInstance.new( 239 @version, 240 payload, 241 chat_service_sid: @solution[:chat_service_sid], 242 conversation_sid: @solution[:conversation_sid], 243 sid: @solution[:sid], 244 ) 245 end