Archive every finished LiveChat conversation in Google Sheets
When a chat ends in LiveChat, the full transcript and its details land in one spreadsheet, and badly rated chats get flagged to your support leads in Slack.
Build me a deterministic code workflow that archives every finished LiveChat conversation into Google Sheets, so we keep a searchable record that outlives LiveChat's own reporting retention. Trigger it with a webhook on LiveChat's chat_deactivated event, which fires whenever a chat is closed.
When the webhook fires, take the chat id from the payload and call LiveChat Get Chat to fetch the finished conversation, including its thread, the events in it, the users on it, and the thread properties. Everything the archive row needs comes straight out of that response, so there is no summarizing or judgement anywhere in this workflow. If Get Chat does not come back with the thread I need, fall back to LiveChat List Threads for that chat id and use the most recent closed thread.
Then append exactly one row to the archive tab of my spreadsheet with Google Sheets Append Values, in this column order: chat id, date, time, agent name, group, customer name, customer email, chat duration, tags, satisfaction rating, transcript. Date and time come from the first event in the thread, rendered in my local timezone as separate columns. Chat duration is the elapsed time between the first and last event in the thread, formatted as minutes and seconds. Agent name and group come from the agent user on the chat and the chat's group assignment. Customer name and email come from the customer user on the chat. Tags are the thread tags joined by commas, left empty when there are none. The satisfaction rating comes from the chat's rating property, written as good, bad, or not rated.
The transcript column holds the whole conversation as plain text. Walk the thread events in order, keep only the message events, and write each one on its own line prefixed by who said it, for example "Agent Maria: Hi, how can I help?" then "Customer: My order never arrived." Use the author's display name where LiveChat provides one and fall back to their role when it does not. No HTML and no JSON, just readable lines separated by newlines so the cell stays searchable with a normal spreadsheet find.
Always append, never update and never overwrite. Append Values adds rows after the last row of the detected table, which is exactly the behaviour I want here: the archive keeps growing and no history is ever lost. Write the header row once if the sheet is empty, then only ever add rows underneath it.
Add one simple check at the end. If the satisfaction rating is bad, also post into my support leads channel with Slack Send a Message, carrying the customer name and email, the agent who handled the chat, the chat id, the duration and the full transcript, so somebody can follow up the same day. If the rating is good or the chat was never rated, skip the Slack step and finish after the spreadsheet row is written.
Make the spreadsheet id, the tab name and the Slack channel configurable inputs. If a field is missing from the chat payload, write an empty cell rather than failing the run, and never let a failed Slack post stop the archive row from being written.
Example output
What does this prompt do?
- Every time a LiveChat conversation is closed, one new row is added to your archive spreadsheet with the chat id, the date and time, the agent, the group, the customer name and email, how long the chat lasted, its tags and its rating.
- The whole conversation is saved as readable text with every line labelled by who said it, so you can search months of old chats by keyword, customer or product name.
- Rows are only ever added and never overwritten, so your history keeps growing even after LiveChat stops showing older conversations in its own reporting.
- If the customer rated the chat badly, your support leads get a Slack message with the customer, the agent and the transcript so somebody can follow up the same day.
What do I need to use this?
- A LiveChat account with access to read chats, and a plan that can notify other tools when a chat is closed
- A Google account and a spreadsheet to use as your chat archive
- A Slack workspace and a channel where your support leads can pick up unhappy customers
How can I customize it?
- Change the columns you keep, or add your own such as the chat source, the page the customer started from, or their country
- Choose which ratings raise the Slack alert: only bad ratings to start with, or every rated chat if you want fuller coverage
- Send the alert to a different channel or a specific team lead, and reword the message to match how your team works
FAQs
Will this overwrite anything already in my spreadsheet?
What happens to chats nobody rated?
Does it archive my old chats too?
Why archive to a spreadsheet instead of just using LiveChat reporting?
Can I send the alerts somewhere other than Slack?
Related templates
When your flight moves, your calendar times get corrected automatically and you get a Slack note naming the meetings you're about to miss.
Every 15 minutes, forwarded phishing reports get traced back to the server that really sent them, with a verdict in Slack and the worst senders reported.
Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.
Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.
Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.
Every Monday, rank the week's matches by expected demand, put the big ones on your venue calendar, and post a rota-ready summary to Slack.
Stop losing chat history to retention limits.
Keep every LiveChat conversation searchable in a spreadsheet you own, and catch unhappy customers the same day they chat.