Integration with E-chat
1. Project Goal
Organize automatic transfer of client conversations from Viber and Telegram messengers through the E-chat service into the 1C:UNF+Auto Service system
2. General Integration Scheme
The client sends a message in Viber/Telegram.
The message is recorded in E-chat.
E-chat generates an event (JSON) and sends it to the company's web server (webhook).
The web server receives the data and forwards it to 1C via the HTTP service "Receiving conversation history from E-chat".
A record is created in the information register "Conversation history in messengers" in 1C.
E-chat API documentation https://help.e-chat.tech/ru/viber/ru-api
3. API Methods to be Used
Viber:
POST/channel/connect - create channel
POST/channel/disconnect - disconnect channel
POST/link to your webhook for incoming message - receive messages
POST/link to your webhook for outgoing message status - receive statuses of outgoing messages
Telegram:
POST/CreateChannel.php - create channel
POST/DisableChannel.php - disconnect channel
POST/:webhook [IncomingMessage] - receive outgoing and incoming messages
POST/:webhook [OutgoingMessageStatus] - receive message statuses
4. E-chat Group in the 1C Interface
Create an E-chat group in the CRM section
In the E-chat group, create Settings. In the settings, I suggest placing API keys for Viber and Telegram and creating buttons with the functionality of the first two API methods for connecting/disconnecting channels. Display the E-chat group to all users (Basic rights UNF). Show settings only to users with full rights and allow changes to E-chat settings only for users with full rights.
In this group, display a new Information Register "Conversation history in messengers". Display only for users with full rights.
5. Information Register "Conversation history in messengers"
Question to the programmer: how architecturally is it better for us to store the conversation history in messengers in 1C - in one register or two separate ones? In the future, the conversation history will be used to control communications with clients and displayed in the Order-Work on two separate tabs.
Create a new Information Register "Conversation history in messengers".
Reading and modification rights are granted only to users with full rights.
5. Logging Configuration
"Enable logging of exchange with E-chat" (Yes/No).
6. Display Conversation History in Order-Work
In the Order-Work document on the Communication tab, add two tabs for Viber and Telegram, and on each tab display the conversation history of the respective messenger. Select conversation messages from 30 minutes before the creation date and until the finish date. Select the counterparty by phone numbers. If the finish date is empty, then use the current date. Access to the tab is granted to the Basic rights UNF role.
6. HTTP Service "Receiving Conversation History from E-chat"
Create an HTTP service in 1C, accessible via HTTPS.
Receive data using the POST method in JSON format.
Validate the authorization token.
Process incoming data:
Record the message in the register "Conversation history in messengers". Depending on the logging setting, it is filled with logs