Chatwoot/lib/webhooks/trigger.rb
Sojan Jose 8d2b719dc1
chore: Sentry issues (#4623)
Fixes various issues reported on sentry

- Twilio channel creation validation errors
- Room Channel error with nil class
- Webhook Uri exception
2022-05-06 14:50:55 +05:30

16 lines
611 B
Ruby

class Webhooks::Trigger
def self.execute(url, payload)
response = RestClient::Request.execute(
method: :post,
url: url, payload: payload.to_json,
headers: { content_type: :json, accept: :json },
timeout: 5
)
Rails.logger.info "Performed Request: Code - #{response.code}"
rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, URI::InvalidURIError => e
Rails.logger.error "Exception: invalid webhook url #{url} : #{e.message}"
rescue StandardError => e
Rails.logger.error "Exception: invalid webhook url #{url} : #{e.message}"
Sentry.capture_exception(e)
end
end