Chatwoot/config/routes.rb

103 lines
2.7 KiB
Ruby
Raw Normal View History

Rails.application.routes.draw do
#AUTH STARTS
match 'auth/:provider/callback', to: 'home#callback', via: [:get, :post]
mount_devise_token_auth_for 'User', at: 'auth', controllers: { confirmations: 'confirmations', passwords: 'passwords' }, via: [:get, :post]
#AUTH STARTS
get "/u", to: "dashboard#index"
get "/u/*params", to: "dashboard#index"
#ROOT STARTS
get '/', to: redirect('/u/login')
match '/status', to: 'home#status', via: [:get] #for elb checks
#AUTH ENDS
#API STARTS
namespace :api do
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
resources :messages, only: [] do
collection do
post :create_incoming
post :create_outgoing
end
end
end
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
resources :facebook_indicators, only:[] do
collection do
post :mark_seen
post :typing_on
post :typing_off
end
end
resources :subscriptions, only: [:index] do
collection do
get :summary
end
end
resources :webhooks, only: [] do
collection do
post :chargebee
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
scope module: :conversations do #for nested controller
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
end
end
#API ENDS
#these routes are only used to put on mailers. DO NOT USE INTERNALLY.
scope module: "mailer" do
resources :conversations, only: [:show]
end
#mailer routes ends
mount Facebook::Messenger::Server, at: 'bot'
post '/webhooks/telegram/:account_id/:inbox_id' => 'home#telegram'
end