Emailing user transcript of conversation

Hi,

I’m relatively new to Botpress. I want to record the conversation for a given session and email it out to the user (a local email variable is set once the user’s email is asked in the conversation flow) after the conversation is finished. To do this, I’m guessing I’ll need to utilise the ‘Testing’ module with scenarios and then integrate that conversation into a product like SendGrid but I’m not fully sure. Does anyone know the easiest and most clear-cut way to achieve this?

Matt

Hey @mattkolomyjec !

Sorry for the (very) late response.

To retrieve the complete conversation transcript, there’s an API route for that. See https://github.com/botpress/botpress/blob/master/modules/channel-web/src/backend/api.ts#L422

You could call this API route from within a Botpress action, and send the transcript as an email from your Botpress action (using axios).

Hope this helps!

Thanks @spgin!

Just implemented what was suggested above, and here are my contributions:

  1. Sample custom action calling API: https://botpress.io/docs/tutorials/external-api#create-an-action
  2. The URL that axios invokes: http://localhost:3000/api/v1/bots/{your-bot-id}/mod/channel-web/conversations/{userId}/${conversationId}/download/txt
  3. The userId and conversationtId can be sourced from {{event.target}} and {{event.threadId}} respectively

Hope it helps!

Thanks a lot for this @ching, that is awesome! :+1: