mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 19:17:48 +00:00 
			
		
		
		
	 04dfb034cc
			
		
	
	04dfb034cc
	
	
	
		
			
			- Upgrade Sentry Libraries - Enable provision for account and user info in error tracking - Add ChatwootExceptionTracker fixes: #4375
		
			
				
	
	
		
			29 lines
		
	
	
		
			686 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			686 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| class Api::V1::WebhooksController < ApplicationController
 | |
|   skip_before_action :authenticate_user!, raise: false
 | |
|   skip_before_action :set_current_user
 | |
| 
 | |
|   def twitter_crc
 | |
|     render json: { response_token: "sha256=#{twitter_client.generate_crc(params[:crc_token])}" }
 | |
|   end
 | |
| 
 | |
|   def twitter_events
 | |
|     twitter_consumer.consume
 | |
|     head :ok
 | |
|   rescue StandardError => e
 | |
|     ChatwootExceptionTracker.new(e).capture_exception
 | |
|     head :ok
 | |
|   end
 | |
| 
 | |
|   private
 | |
| 
 | |
|   def twitter_client
 | |
|     Twitty::Facade.new do |config|
 | |
|       config.consumer_secret = ENV.fetch('TWITTER_CONSUMER_SECRET', nil)
 | |
|     end
 | |
|   end
 | |
| 
 | |
|   def twitter_consumer
 | |
|     @twitter_consumer ||= ::Webhooks::Twitter.new(params)
 | |
|   end
 | |
| end
 |