mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-11-04 04:57:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			34 lines
		
	
	
		
			685 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
		
			685 B
		
	
	
	
		
			JavaScript
		
	
	
		
			Executable File
		
	
	
	
	
const sendMessage = content => ({
 | 
						|
  url: `/api/v1/widget/messages${window.location.search}`,
 | 
						|
  params: {
 | 
						|
    message: {
 | 
						|
      content,
 | 
						|
      timestamp: new Date().toString(),
 | 
						|
      referer_url: window.refererURL || '',
 | 
						|
    },
 | 
						|
  },
 | 
						|
});
 | 
						|
 | 
						|
const getConversation = ({ before }) => ({
 | 
						|
  url: `/api/v1/widget/messages${window.location.search}`,
 | 
						|
  params: { before },
 | 
						|
});
 | 
						|
 | 
						|
const updateContact = id => ({
 | 
						|
  url: `/api/v1/widget/messages/${id}${window.location.search}`,
 | 
						|
});
 | 
						|
 | 
						|
const getAvailableAgents = token => ({
 | 
						|
  url: '/api/v1/widget/inbox_members',
 | 
						|
  params: {
 | 
						|
    website_token: token,
 | 
						|
  },
 | 
						|
});
 | 
						|
 | 
						|
export default {
 | 
						|
  sendMessage,
 | 
						|
  getConversation,
 | 
						|
  updateContact,
 | 
						|
  getAvailableAgents,
 | 
						|
};
 |