feat: Add Cron Jobs In Chatwoot and update installation notice (#1630)
This commit is contained in:
22
lib/chatwoot_hub.rb
Normal file
22
lib/chatwoot_hub.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class ChatwootHub
|
||||
BASE_URL = 'https://hub.chatwoot.com'.freeze
|
||||
|
||||
def self.instance_config
|
||||
{
|
||||
installationVersion: Chatwoot.config[:version],
|
||||
installationHost: URI.parse(ENV.fetch('FRONTEND_URL', '')).host
|
||||
}
|
||||
end
|
||||
|
||||
def self.latest_version
|
||||
begin
|
||||
response = RestClient.get(BASE_URL, { params: instance_config })
|
||||
version = JSON.parse(response)['version']
|
||||
rescue *ExceptionList::REST_CLIENT_EXCEPTIONS, *ExceptionList::URI_EXCEPTIONS => e
|
||||
Rails.logger.info "Exception: #{e.message}"
|
||||
rescue StandardError => e
|
||||
Raven.capture_exception(e)
|
||||
end
|
||||
version
|
||||
end
|
||||
end
|
||||
@@ -25,4 +25,7 @@ module Redis::RedisKeys
|
||||
# Used to track token expiry and such issues for facebook slack integrations etc
|
||||
AUTHORIZATION_ERROR_COUNT = 'AUTHORIZATION_ERROR_COUNT:%<obj_type>s:%<obj_id>d'.freeze
|
||||
REAUTHORIZATION_REQUIRED = 'REAUTHORIZATION_REQUIRED:%<obj_type>s:%<obj_id>d'.freeze
|
||||
|
||||
## Internal Installation related keys
|
||||
LATEST_CHATWOOT_VERSION = 'LATEST_CHATWOOT_VERSION'.freeze
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user