https://discord.gg/botpress logo
Chat history included in email
# 🤝help
i
We've added a feature to send us an email via the bot if the bot isn't able to answer your question. However, i can't seem to work out a simple way to include the chat history? Its frustrating for the customer to then have to re-explain to use what they wanted to do (and lacks detail of why it didn't work.) We would prefer an actual dialog back and forth, between customer and bot instead of a chat-id to go and find in the admin as we're finding the admin features quite clunky.
o
Unfortunately, Botpress doesn't currently provide a built-in way to include the full conversation history in email notifications. The usual approach is to store the conversation transcript during the chat (via Tables, Variables, or an external database) and include it in the email when the fallback is triggered. That gives your team the full back-and-forth instead of just a chat ID. If you'd like, I can help you set that up so the emails contain the complete conversation context automatically. @important-musician-39432
q
Hey Mark, I would recommend you use {{conversation.SummaryAgent.transcript}} in the email body. It is available by enabling the Summary Agent and setting Transcript Max Messages to 0 for the whole back-and-forth (or up to 100), and {{conversation.SummaryAgent.summary}} alongside it if you also want a one-paragraph "here's what they were trying to do." If you need more control over the formatting, the two alternatives are the built-in event.state.session.history array (last 30 turns, each preview capped at 300 characters, mapped to text in an Execute Code card) or building your own string in Before Incoming / Before Outgoing hooks, e.g. appending each message to event.state.session.fullHistory, which has no length cap beyond the 128 kB session limit.