- 16 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Webchat File Attachment for API
- Updated on 16 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Your customers can share "IMAGE, AUDIO, VIDEO, DOCUMENT" files with your company in chat sessions. The agent can respond in the same way. You can access the web service from this link.
Two new services have been added to Webchat services. These services;
1-) UploadFile
2-) SendMessage
1- UploadFile
For this, it should make a request to the service with the CHATID and fileDetails fields as parameters. The fileDetails parameter must be in json format.
For UploadFile;
{"fileUrl": "https: // {SERVER_IP} /public_files/20210304-4865c412-7c28-45e4-9f55-3bd039401734.png", "fileName": "20210304-4865c412-7c28-45e4-9f55-3bd039401734.png" "fileType": "IMAGE"}
The important thing is that the file you want to send is at a downloadable URL.
2-SendMassage
The SendMessage service is designed to minimize users making mistakes while sending text or file messages. Here it should be sent in json format and the CHATID and fileDetails information should be entered into the webservice.
For sending FILE;
{"CHATID": "12345", "message": {"fileDetails": {"fileUrl": "https: // {SERVER_IP} /public_files/20210304-cb78d4cb-ec7c-4f0b-9615-8b1df3ff9300.wav", " fileName ":" 20210304-cb78d4cb-ec7c-4f0b-9615-8b1df3ff9300.wav "," fileType ":" AUDIO "}}}
For sending TEXT messages;
{"CHATID": "12345", "message": {"text": "test message"}}
To send TEXT and FILE at the same time;
{"CHATID": "12345", "message": {"text": "file and text", "fileDetails": {"fileUrl": "https: // {SERVER_IP} / public_files / 20210304-cb78d4cb-ec7c- 4f0b-9615-8b1df3ff9300.wav "," fileName ":" 20210304-cb78d4cb-ec7c-4f0b-9615-8b1df3ff9300.wav "," fileType ":" AUDIO "}}}
After the definitions is done, when the agent is answering, they can send the appropriate files and videos to the customer in response by pressing the attach sign under the chat message on the left.