Table of Contents
Assistant Template: General Structure and Files
When a developer downloads the Assistant sample project, the project structure is organized as follows:
Project Structure
- Channels
- Dialogs
- appsettings.json
- Program.cs
Channels Folder
This folder contains two crucial classes:
- CxPerium.cs:
- A class that captures events coming from CxPerium.
- Sample Events:
- OnSurveyCompleted: Triggered when a survey is completed.
- OnClosingLiveChat: Triggered when a live chat is closed by the agent.
- OnSessionTimeOut: If no message is received from the user for a specific duration, the user session ends, and this event is triggered.
Note: The duration (X) is set in the Assistant > Configuration screen under SessionTimeOutConfig. The default value is 5 minutes.
- Whatsapp.cs:
- This class processes all incoming messages and events from CxPerium.
- Sample Events:
- OnDialogFlowMessage: Triggered if the message is caught by DialogFlow.
- OnChatGPTMessage: Triggered if the message is caught by ChatGPT.
- OnFileReceived: Triggered when the user sends a file via WhatsApp.
- OnOrderReceived: Triggered when the user sends an order via WhatsApp.
- OnLocationReceived: Triggered when the user sends a location.
- GetContactByPhone: Retrieves the sender’s information from the Contacts list in CxPerium.
- OnUnderstandMessage: Triggered if the message is not caught by any NLP in CxPerium. By default, the user receives the response: “Sorry, I didn’t understand what you meant!”
Note: It is recommended not to modify this file unless necessary. For special requirements, methods within the class can be overridden.
Dialogs Folder
- This folder contains only one file: MainDialog.cs.
- All dialogs should be developed under this folder to ensure better code readability. This is recommended as a best practice.
- appsettings.json:
- Represents the file where API Keys or Hook information from CxPerium are entered.
This structure is optimized to help developers quickly meet their fundamental requirements when starting work. Proper organization of each file and class according to its functionality ensures the project remains scalable and manageable.