2019-08-14 09:48:44 +00:00
|
|
|
Rails.application.routes.draw do
|
2019-10-20 08:47:26 +00:00
|
|
|
# AUTH STARTS
|
2019-08-14 09:48:44 +00:00
|
|
|
match 'auth/:provider/callback', to: 'home#callback', via: [:get, :post]
|
2020-02-02 17:22:38 +00:00
|
|
|
mount_devise_token_auth_for 'User', at: 'auth', controllers: {
|
|
|
|
confirmations: 'devise_overrides/confirmations',
|
|
|
|
passwords: 'devise_overrides/passwords',
|
|
|
|
sessions: 'devise_overrides/sessions',
|
|
|
|
token_validations: 'devise_overrides/token_validations'
|
|
|
|
}, via: [:get, :post]
|
2019-08-14 09:48:44 +00:00
|
|
|
|
2019-10-20 08:47:26 +00:00
|
|
|
root to: 'dashboard#index'
|
2019-08-25 14:29:28 +00:00
|
|
|
|
2019-10-20 08:47:26 +00:00
|
|
|
get '/app', to: 'dashboard#index'
|
|
|
|
get '/app/*params', to: 'dashboard#index'
|
2020-03-28 06:21:42 +00:00
|
|
|
get '/app/accounts/:account_id/settings/inboxes/new/twitter', to: 'dashboard#index', as: 'app_new_twitter_inbox'
|
|
|
|
get '/app/accounts/:account_id/settings/inboxes/new/:inbox_id/agents', to: 'dashboard#index', as: 'app_twitter_inbox_agents'
|
2019-08-25 14:29:28 +00:00
|
|
|
|
2020-01-09 07:36:40 +00:00
|
|
|
resource :widget, only: [:show]
|
2019-10-29 07:20:54 +00:00
|
|
|
|
2020-04-16 09:35:01 +00:00
|
|
|
get '/api', to: 'api#index'
|
2019-12-23 06:46:46 +00:00
|
|
|
namespace :api, defaults: { format: 'json' } do
|
2019-08-14 09:48:44 +00:00
|
|
|
namespace :v1 do
|
2020-03-09 17:57:10 +00:00
|
|
|
# ----------------------------------
|
|
|
|
# start of account scoped api routes
|
2020-03-29 06:46:31 +00:00
|
|
|
resources :accounts, only: [:create, :show, :update], module: :accounts do
|
2020-05-26 17:08:48 +00:00
|
|
|
member do
|
|
|
|
post :update_active_at
|
|
|
|
end
|
2020-03-09 17:57:10 +00:00
|
|
|
namespace :actions do
|
|
|
|
resource :contact_merge, only: [:create]
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
2020-02-14 17:49:17 +00:00
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
resources :agents, except: [:show, :edit, :new]
|
|
|
|
resources :callbacks, only: [] do
|
|
|
|
collection do
|
|
|
|
post :register_facebook_page
|
|
|
|
get :register_facebook_page
|
|
|
|
post :facebook_pages
|
|
|
|
post :reauthorize_page
|
|
|
|
end
|
2020-02-02 10:59:18 +00:00
|
|
|
end
|
2020-03-09 17:57:10 +00:00
|
|
|
resources :canned_responses, except: [:show, :edit, :new]
|
2020-04-05 16:41:27 +00:00
|
|
|
namespace :channels do
|
|
|
|
resource :twilio_channel, only: [:create]
|
|
|
|
end
|
2020-04-10 11:12:37 +00:00
|
|
|
resources :conversations, only: [:index, :create, :show] do
|
2020-05-03 06:45:10 +00:00
|
|
|
get 'meta', on: :collection
|
2020-03-09 17:57:10 +00:00
|
|
|
scope module: :conversations do
|
|
|
|
resources :messages, only: [:index, :create]
|
|
|
|
resources :assignments, only: [:create]
|
|
|
|
resources :labels, only: [:create, :index]
|
|
|
|
end
|
|
|
|
member do
|
2020-05-26 12:13:59 +00:00
|
|
|
post :mute
|
2020-03-09 17:57:10 +00:00
|
|
|
post :toggle_status
|
2020-05-03 06:47:27 +00:00
|
|
|
post :toggle_typing_status
|
2020-03-09 17:57:10 +00:00
|
|
|
post :update_last_seen
|
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
resources :contacts, only: [:index, :show, :update, :create] do
|
|
|
|
scope module: :contacts do
|
|
|
|
resources :conversations, only: [:index]
|
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
2020-03-09 17:57:10 +00:00
|
|
|
|
|
|
|
resources :facebook_indicators, only: [] do
|
|
|
|
collection do
|
|
|
|
post :mark_seen
|
|
|
|
post :typing_on
|
|
|
|
post :typing_off
|
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
|
2020-04-19 18:10:28 +00:00
|
|
|
resources :inboxes, only: [:index, :create, :update, :destroy] do
|
2020-04-07 05:11:18 +00:00
|
|
|
post :set_agent_bot, on: :member
|
|
|
|
end
|
2020-03-09 17:57:10 +00:00
|
|
|
resources :inbox_members, only: [:create, :show], param: :inbox_id
|
|
|
|
resources :labels, only: [:index] do
|
|
|
|
collection do
|
|
|
|
get :most_used
|
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
2020-03-09 17:57:10 +00:00
|
|
|
|
2020-05-01 09:23:43 +00:00
|
|
|
resources :notifications, only: [:index, :update]
|
2020-03-09 17:57:10 +00:00
|
|
|
resource :notification_settings, only: [:show, :update]
|
|
|
|
|
|
|
|
# this block is only required if subscription via chargebee is enabled
|
|
|
|
resources :subscriptions, only: [:index] do
|
|
|
|
collection do
|
|
|
|
get :summary
|
|
|
|
end
|
2020-01-13 05:47:03 +00:00
|
|
|
end
|
2020-03-09 17:57:10 +00:00
|
|
|
|
|
|
|
resources :webhooks, except: [:show]
|
2020-01-13 05:47:03 +00:00
|
|
|
end
|
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
# end of account scoped api routes
|
|
|
|
# ----------------------------------
|
|
|
|
|
|
|
|
resource :profile, only: [:show, :update]
|
2020-05-01 09:23:43 +00:00
|
|
|
resource :notification_subscriptions, only: [:create]
|
2020-03-09 17:57:10 +00:00
|
|
|
|
2020-04-07 05:11:18 +00:00
|
|
|
resources :agent_bots, only: [:index]
|
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
namespace :widget do
|
2020-04-10 11:12:37 +00:00
|
|
|
resources :events, only: [:create]
|
|
|
|
resources :messages, only: [:index, :create, :update]
|
2020-05-04 17:37:56 +00:00
|
|
|
resources :conversations do
|
|
|
|
collection do
|
|
|
|
post :toggle_typing
|
|
|
|
end
|
|
|
|
end
|
2020-04-03 07:34:58 +00:00
|
|
|
resource :contact, only: [:update]
|
2020-03-09 17:57:10 +00:00
|
|
|
resources :inbox_members, only: [:index]
|
2020-04-03 07:34:58 +00:00
|
|
|
resources :labels, only: [:create, :destroy]
|
2020-02-17 02:21:45 +00:00
|
|
|
end
|
2019-12-23 06:46:46 +00:00
|
|
|
|
2020-02-17 02:21:45 +00:00
|
|
|
resources :webhooks, only: [] do
|
|
|
|
collection do
|
|
|
|
post :chargebee
|
2019-11-24 13:39:17 +00:00
|
|
|
end
|
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
2020-03-28 06:21:42 +00:00
|
|
|
|
|
|
|
namespace :v2 do
|
2020-03-18 11:23:35 +00:00
|
|
|
resources :accounts, only: [], module: :accounts do
|
|
|
|
resources :reports, only: [] do
|
|
|
|
collection do
|
|
|
|
get :account
|
|
|
|
end
|
|
|
|
member do
|
|
|
|
get :account_summary
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
|
2020-02-11 08:57:38 +00:00
|
|
|
namespace :twitter do
|
|
|
|
resource :authorization, only: [:create]
|
|
|
|
resource :callback, only: [:show]
|
|
|
|
end
|
|
|
|
|
2020-04-05 16:41:27 +00:00
|
|
|
namespace :twilio do
|
|
|
|
resources :callback, only: [:create]
|
|
|
|
end
|
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
# ----------------------------------------------------------------------
|
2019-12-23 06:46:46 +00:00
|
|
|
# Used in mailer templates
|
|
|
|
resource :app, only: [:index] do
|
2020-03-29 04:04:57 +00:00
|
|
|
resources :accounts do
|
|
|
|
resources :conversations, only: [:show]
|
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
# ----------------------------------------------------------------------
|
|
|
|
# Routes for social integrations
|
2019-08-14 09:48:44 +00:00
|
|
|
mount Facebook::Messenger::Server, at: 'bot'
|
2020-02-02 19:09:00 +00:00
|
|
|
get 'webhooks/twitter', to: 'api/v1/webhooks#twitter_crc'
|
|
|
|
post 'webhooks/twitter', to: 'api/v1/webhooks#twitter_events'
|
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
# ----------------------------------------------------------------------
|
2019-11-01 07:23:01 +00:00
|
|
|
# Routes for testing
|
|
|
|
resources :widget_tests, only: [:index] unless Rails.env.production?
|
2020-01-05 17:56:22 +00:00
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
2020-05-03 06:46:11 +00:00
|
|
|
# Routes for external service verifications
|
|
|
|
get 'apple-app-site-association' => 'apple_app#site_association'
|
|
|
|
|
|
|
|
# ----------------------------------------------------------------------
|
2020-01-05 17:56:22 +00:00
|
|
|
# Internal Monitoring Routes
|
|
|
|
require 'sidekiq/web'
|
|
|
|
|
2020-05-11 17:37:22 +00:00
|
|
|
devise_for :super_admins, path: 'super_admin', controllers: { sessions: 'super_admin/devise/sessions' }
|
|
|
|
devise_scope :super_admin do
|
|
|
|
get 'super_admin/logout', to: 'super_admin/devise/sessions#destroy'
|
|
|
|
namespace :super_admin do
|
2020-06-02 18:20:39 +00:00
|
|
|
root to: 'dashboard#index'
|
|
|
|
|
|
|
|
# order of resources affect the order of sidebar navigation in super admin
|
2020-05-11 17:37:22 +00:00
|
|
|
resources :accounts
|
2020-06-02 18:20:39 +00:00
|
|
|
resources :users, only: [:index, :new, :create, :show, :edit, :update]
|
2020-05-11 17:37:22 +00:00
|
|
|
resources :super_admins
|
2020-05-24 17:14:26 +00:00
|
|
|
resources :access_tokens, only: [:index, :show]
|
2020-05-11 17:37:22 +00:00
|
|
|
|
2020-06-02 18:20:39 +00:00
|
|
|
# resources that doesn't appear in primary navigation in super admin
|
|
|
|
resources :account_users, only: [:new, :create, :destroy]
|
|
|
|
resources :agent_bots, only: [:index, :new, :create, :show, :edit, :update]
|
2020-05-11 17:37:22 +00:00
|
|
|
end
|
|
|
|
authenticated :super_admin do
|
|
|
|
mount Sidekiq::Web => '/monitoring/sidekiq'
|
2020-01-05 17:56:22 +00:00
|
|
|
end
|
|
|
|
end
|
2020-02-23 07:24:29 +00:00
|
|
|
|
2020-03-09 17:57:10 +00:00
|
|
|
# ---------------------------------------------------------------------
|
2020-02-23 07:24:29 +00:00
|
|
|
# Routes for swagger docs
|
|
|
|
get '/swagger/*path', to: 'swagger#respond'
|
|
|
|
get '/swagger', to: 'swagger#respond'
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|