Sending ticket history to the attendant's email March 12, 2024 14:47 Updated At the end of each human service, it is possible to retrieve the entire service history using some actions within the flow and send this history to the attendant's email. To do so, just follow the steps below: In the block obligatorily after the Human Service block, you must set 4 input actions. The first action will be to Execute Script to get the e-mail of the attendant who handled the ticket, already in the correct format. In the input variable, you will enter the variable input.content. In addition, you must save the return in a new variable, emailAgente. In the body of the script, enter the following: function run(inputVariable1) { let obj = JSON.parse(inputVariable1) let emailAgente = obj.agentIdentity.split("@")[0] return emailAgente } Now, for the second action we will create an HTTP request. Enter the method, command url, headers and return variables as shown below: Note: To find out which is your authentication key used in the Authorization key, click here. Note: Use the url with the contract id to consume the endpoints reported below, its performance and operation may be impacted if it does not have the contract id, so it is essential to use the url with the contract id to use http requests!POST https://{{contractid}}.http.msging.net/commands Content-Type: application/json Authorization: Key {YOUR_TOKEN} In the body of the request, enter the following: { "id": "{{random.guid}}", "to": "postmaster@desk.msging.net", "method": "GET", "uri": "/ticket/{{input.content@id}}/history-file"} For the third Run Script action, in the input variable, you will enter the variable historyTicket. In addition, you must also save the return in a new variable, linkTicket. In the body of the script, enter the following: function run(ticket) { let ticket = JSON.parse(ticket) let pdf = ticket.resource return pdf.replace(" ", "%20");} In the fourth HTTP request action, configure it like this: Again, to find out what your authentication key is used in the Authorization key, click here. POST https://http.msging.net/messages Content-Type: application/json Authorization: Key {YOUR_TOKEN} In the body of the request: { "id": "{{random.guid}}", "to": "{{emailAgente}}@mailgun.gw.msging.net", "type": "text/plain", "content": "{{historyTicket@resource}}"} Note: The “emailAgente” variable used in the request will be the same one that was saved as return in the execution of the script. Email return: Open all email content in one tab to view the history: Additional information Media links on Blip expire in 15 minutes, so download the history to your computer if you want to visit again. For more information, visit the discussion on the subject in our community or the videos on our channel. 😃 Related articles Service History How to Save Data from Human Service Service History for Agents, on Blip Desk How to save human service history via Blip Integration with Google Drive How to review a contact's chat history