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!

1 Like

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

hello
i am working on a similar task i want to download the transcript conversation by default using call api skill and then send it by using the send email skill so can i get some help with that
i have tried this url : http://localhost:3000/api/v1/bots/my bot id/mod/channel-web/conversations/{{event.target}}/{{event.threadId}}/download/txt.
and i have implemented it in this code :
async function action(bp: typeof sdk, event: sdk.IO.IncomingEvent, args: any, { user, temp, session } = event.state){
/** Your code starts below */

const axios = require(‘axios’)

/**

// We assign the response to the session variable so we can use it later
session.response = data

}

// Actions are async, so make sure to return a promise
return callApi()
/** Your code ends here */
}
but i am getting an error 404 not found so please i hope to get a reply and thank you in advance