
The Salesforce Messaging for Web REST API offers an endpoint that allows us to export or download the conversation transcript. To do so, you need to provide the Conversation ID and include the Authorization header with the Bearer followed by the access token. This is necessary for a successful GET request to retrieve the Conversation Transcript.
We have to do a GET request to the following endpoint to retrieve the Salesforce Messaging for Web Conversation Transcript.
Endpoint:
https://{scrt-url}/iamessage/api/v2/conversation/{conversationId}/transcript
Prerequisite:
1. Setup Messaging Channel and Embedded Service Deployment.
2. Make sure “Let customers download their conversation transcripts” is enabled on the Messaging Channel.

If you want to download using Python, then you can use the following sample code.
Sample Python Code:
from requests import get
import Variables
# POST request to Send the Message
response = get(
Variables.base_scrt2_url + 'conversation/' + Variables.conversation_id + '/transcript?esDeveloperName=MIAW_REST_API',
headers = {
'Authorization': 'Bearer ' + Variables.access_token
}
)
# Printing the Status Code
print( response.status_code )
# Downloading the Conversation Transcript
open( 'Conversation Transcript.pdf','wb' ).write( response.content )
The above Python code will extract the Conversation Transcript and save it in a file with the name “Conversation Transcript”.
If you want more information on the Python programming invoking Salesforce Messaging for Web APIs, please check the following: