mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	This change targets the public API and is related to the Inbox with channel type API.
Exposes public inbox details under /public/api/v1/inboxes/{inbox_identifier}. This allows access to feature flags and business hours configured for the inbox.
ref: #5514
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			669 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			669 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
require 'rails_helper'
 | 
						|
 | 
						|
RSpec.describe 'Public Inbox API', type: :request do
 | 
						|
  let!(:api_channel) { create(:channel_api) }
 | 
						|
 | 
						|
  describe 'GET /public/api/v1/inboxes/{identifier}' do
 | 
						|
    it 'is able to fetch the details of an inbox' do
 | 
						|
      get "/public/api/v1/inboxes/#{api_channel.identifier}"
 | 
						|
 | 
						|
      expect(response).to have_http_status(:success)
 | 
						|
      data = response.parsed_body
 | 
						|
 | 
						|
      expect(data.keys).to include('name', 'timezone', 'working_hours', 'working_hours_enabled')
 | 
						|
      expect(data.keys).to include('csat_survey_enabled', 'greeting_enabled', 'identity_validation_enabled')
 | 
						|
      expect(data['identifier']).to eq api_channel.identifier
 | 
						|
    end
 | 
						|
  end
 | 
						|
end
 |