feat: Add Cron Jobs In Chatwoot and update installation notice (#1630)

This commit is contained in:
Sojan Jose
2021-01-11 17:34:41 +05:30
committed by GitHub
parent 160a6fc6cf
commit 346830ab1d
12 changed files with 95 additions and 1 deletions

22
lib/chatwoot_hub.rb Normal file
View 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

View File

@@ -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