Salesforce Messaging for Web API Retrieve Conversation Transcript
2K views
Feb 19, 2025
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. Blog Post: https://www.infallibletechie.com/2025/02/salesforce-retrieve-conversation-transcript-messaging-for-web-api.html
View Video Transcript
0:05
hello everyone in this video we are
0:07
going to see how to retrieve
0:10
conversation transcript when using
0:12
Salesforce messaging for web
0:15
apis if you're using Salesforce
0:18
messaging for web rest
0:20
apis to invoke messaging services uh so
0:25
that a messaging session will be created
0:27
it will be uh routed to an agent and
0:31
then if you are having any third party
0:32
application using messaging for rest uh
0:36
messaging for web rest apis and then if
0:39
you have a requirement where you wanted
0:40
to download the conversation
0:44
transcript then we can make use
0:47
of transcript uh uh path um in the
0:52
messaging for web rest API uh
0:57
endpoint uh if you are pretty new to
0:59
Salesforce messaging for inapp and web
1:01
rest API then you can make use of this
1:04
link where we have to create a messaging
1:06
Channel and then we have to create
1:07
embeded service deployment in the
1:11
messaging uh Channel we have to make
1:13
sure let customers download their
1:15
conversation
1:16
transcripts option is enabled this is
1:19
mandatory if you wanted to uh download
1:23
the uh
1:25
transcript
1:28
okay um
1:30
and then we have to make a get request
1:33
to your Salesforce SRT uh URL we will
1:37
get this URL from the Cod snippet from
1:41
the embeded service deployment slash
1:44
amessage API slv2 SL conversation slon
1:48
conversation ID when we create a
1:50
conversation we pass a uu ID to create
1:53
the conversation so we have to make use
1:55
of the same uu ID so that we will be
1:59
able to get the transcript so
2:02
conversation id/ transcript so when you
2:04
do do a get request um with the header
2:08
authorization as a bar space access
2:11
token then we will be able to uh
2:14
download it I have also given a sample
2:17
python code for your reference you can
2:19
also make use of python so now let's uh
2:23
uh see a demo uh how to connect to um
2:28
the transcript download load endpoint
2:31
and then uh download it from the postman
2:34
the first step is we have to get an
2:36
access token next we have to create a
2:38
conversation uh uh in Salesforce in
2:41
order to do that I need uu ID so I'm
2:44
going to get uh an uu
2:48
ID I'm going to make use
2:52
of this as the conversation ID
3:02
the conversation is created it will
3:04
create a messaging session in my
3:06
Salesforce
3:09
or I'm going to subscribe
3:15
uh I'm going to subscribe to the server
3:19
sent events I can send a message
3:30
okay there was an issue so I'm going to
3:33
send a
3:48
message because of some Extra Spaces it
3:51
is not sending let me fix
3:58
that okay
4:00
it is not okay I I have to change this
4:04
so let me get one more uu
4:14
ID so this is another uu ID to send a
4:19
message uh meanwhile to keep the session
4:24
active testing test these are all the
4:28
message uh from the
4:31
agent so here I have to use
4:35
another uu
4:41
ID okay there some
4:45
isue I have to use
4:48
slash message
5:01
interesting uh let me make use
5:14
of in order to send a
5:17
message I have to use
5:20
this okay so I was able to send a
5:23
message so this is the testing message
5:25
from
5:27
Postman I'm going to close the
5:29
conversation
5:32
conversation is closed now I'm going to
5:34
export
5:36
it let me send a get request so I I I'm
5:41
able to see all the conversation that
5:43
happened between uh the agent and the
5:48
user okay now let's see how to do the
5:51
same
5:54
using um python so in Python I am making
5:58
use of uh
6:01
open method and I'm going to open a file
6:05
called conversation transcript. PDF and
6:08
then I'm going
6:10
to um open it in uh bytes format and
6:14
then using uh request Library I'm
6:19
getting the get method from the get
6:21
method I am I'm doing a get request with
6:24
the header I'm just printing printing
6:27
the status code once I get the response
6:30
content I'm writing it to this PDF file
6:35
so as of now if I go
6:40
to so here I don't have any file called
6:46
conversation script transcript so let's
6:51
run this okay so first I have to get the
6:53
access
6:54
token next I have to create the
6:57
conversation in Python
6:59
next I have to subscribe to it I'm able
7:03
to get the messaging
7:07
session so I'm going to send a
7:11
message testing from python is the
7:13
message so I should be able to see that
7:15
message I'm going to send testing done
7:20
demo so these are all the messages I'm
7:22
sending it as an
7:24
agent um so now here if I want to close
7:28
the conversation I I can close it so I'm
7:31
going to download it so let me download
7:33
the file now okay status code is 200 so
7:37
it got downloaded so this is the
7:43
file so make use of this endpoint URL uh
7:48
you have to use your uh scrt2 URL so
7:52
that you will be able to download the
7:55
conversation transcript
8:02
please check the video description in
8:03
the video description I have given my
8:05
blog post from the blog post you should
8:07
be able to get the python code which I
8:10
was showing it on the demo for your
8:12
reference and also you should be able to
8:15
get the
8:16
screenshot and the endpoint with uh uh
8:19
more information from the blog post so
8:22
that you can play
8:27
around I hope it was
8:34
helpful thank you for watching
#Intelligent Personal Assistants
#Internet Software
#Text & Instant Messaging
#Voice & Video Chat