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]
|
2019-08-19 08:19:57 +00:00
|
|
|
mount_devise_token_auth_for 'User', at: 'auth', controllers: { confirmations: 'confirmations', passwords: 'passwords',
|
2019-10-20 08:47:26 +00:00
|
|
|
sessions: 'sessions' }, 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'
|
2019-08-25 14:29:28 +00:00
|
|
|
|
|
|
|
match '/status', to: 'home#status', via: [:get]
|
2019-08-14 09:48:44 +00:00
|
|
|
|
2019-10-29 07:20:54 +00:00
|
|
|
resources :widgets, only: [: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
|
|
|
|
resources :callbacks, only: [] do
|
|
|
|
collection do
|
|
|
|
post :register_facebook_page
|
|
|
|
get :register_facebook_page
|
|
|
|
post :get_facebook_pages
|
|
|
|
post :reauthorize_page
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
namespace :widget do
|
2019-10-29 07:20:54 +00:00
|
|
|
resources :messages, only: [:index, :create]
|
2019-12-28 16:26:42 +00:00
|
|
|
resources :inboxes, only: [:create, :update]
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
|
2019-12-24 07:57:25 +00:00
|
|
|
namespace :actions do
|
|
|
|
resource :contact_merge, only: [:create]
|
|
|
|
end
|
|
|
|
|
2019-12-10 04:59:35 +00:00
|
|
|
resource :profile, only: [:show, :update]
|
2019-08-14 09:48:44 +00:00
|
|
|
resources :accounts, only: [:create]
|
|
|
|
resources :inboxes, only: [:index, :destroy]
|
|
|
|
resources :agents, except: [:show, :edit, :new]
|
|
|
|
resources :contacts, only: [:index, :show, :update, :create]
|
|
|
|
resources :labels, only: [:index]
|
|
|
|
resources :canned_responses, except: [:show, :edit, :new]
|
|
|
|
resources :inbox_members, only: [:create, :show], param: :inbox_id
|
2019-10-20 08:47:26 +00:00
|
|
|
resources :facebook_indicators, only: [] do
|
2019-08-14 09:48:44 +00:00
|
|
|
collection do
|
|
|
|
post :mark_seen
|
|
|
|
post :typing_on
|
|
|
|
post :typing_off
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
resources :reports, only: [] do
|
|
|
|
collection do
|
|
|
|
get :account
|
|
|
|
get :agent
|
|
|
|
end
|
|
|
|
member do
|
|
|
|
get :account_summary
|
|
|
|
get :agent_summary
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
resources :conversations, only: [:index, :show] do
|
2019-10-20 08:47:26 +00:00
|
|
|
scope module: :conversations do # for nested controller
|
2019-08-14 09:48:44 +00:00
|
|
|
resources :messages, only: [:create]
|
|
|
|
resources :assignments, only: [:create]
|
|
|
|
resources :labels, only: [:create, :index]
|
|
|
|
end
|
|
|
|
member do
|
|
|
|
post :toggle_status
|
|
|
|
post :update_last_seen
|
|
|
|
get :get_messages
|
|
|
|
end
|
|
|
|
end
|
2019-11-24 13:39:17 +00:00
|
|
|
|
|
|
|
# this block is only required if subscription via chargebee is enabled
|
|
|
|
if ENV['BILLING_ENABLED']
|
|
|
|
resources :subscriptions, only: [:index] do
|
|
|
|
collection do
|
|
|
|
get :summary
|
|
|
|
end
|
|
|
|
end
|
2019-12-23 06:46:46 +00:00
|
|
|
|
2019-11-24 13:39:17 +00:00
|
|
|
resources :webhooks, only: [] do
|
|
|
|
collection do
|
|
|
|
post :chargebee
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-12-24 21:33:02 +00:00
|
|
|
# Sidekiq Web UI
|
|
|
|
require 'sidekiq/web'
|
2019-12-28 16:26:42 +00:00
|
|
|
authenticate :user, ->(u) { u.administrator? } do
|
2019-12-24 21:33:02 +00:00
|
|
|
mount Sidekiq::Web => '/sidekiq'
|
|
|
|
end
|
|
|
|
|
2019-12-23 06:46:46 +00:00
|
|
|
# Used in mailer templates
|
|
|
|
resource :app, only: [:index] do
|
2019-08-14 09:48:44 +00:00
|
|
|
resources :conversations, only: [:show]
|
|
|
|
end
|
|
|
|
|
|
|
|
mount Facebook::Messenger::Server, at: 'bot'
|
|
|
|
post '/webhooks/telegram/:account_id/:inbox_id' => 'home#telegram'
|
2019-11-01 07:23:01 +00:00
|
|
|
|
|
|
|
# Routes for testing
|
|
|
|
resources :widget_tests, only: [:index] unless Rails.env.production?
|
2019-08-14 09:48:44 +00:00
|
|
|
end
|