Invoke Salesforce Agentforce using REST API
2K views
Nov 18, 2024
Using Salesforce Messaging for In-App and Web REST API, we can invoke Salesforce Agentforce using REST API. Blog Post: https://www.infallibletechie.com/2024/11/invoke-salesforce-agentforce-using-rest-api.html
View Video Transcript
0:07
hello everyone in this video we are
0:09
going to see how to invoke Salesforce
0:12
agent force using rest
0:15
API in order to invoke Salesforce agent
0:18
force using resty API I'm going to make
0:20
use of Salesforce messaging for inapp
0:23
and web rest
0:25
apis if you new to Salesforce messaging
0:28
for inapp and web rest
0:30
AP setup then you have to go to this
0:34
blog post using which you will be able
0:37
to set up your Salesforce messaging for
0:40
inap and web for rest
0:45
apis for uh Salesforce messaging for
0:48
inap and web we create messaging channel
0:51
of type messaging for inap and web in
0:56
that I am making use of routing type as
0:59
Omni flow and I'm using a flow with the
1:03
name Ma aw agent force
1:06
flow in this
1:08
flow I making use of Route work flow
1:12
element to Route the Salesforce
1:14
messaging session to the agent force
1:19
service agent and this is
1:21
the a agent force agent which I have set
1:24
it up in the or so since I'm using route
1:27
to agent for service agent it will
1:30
directly routed to the uh agent force
1:35
agent the first step is we have to get
1:39
uh the access token so I'm sending a
1:42
request and I have the access token I
1:46
have a simple script which stores the uh
1:48
access
1:50
token in this ma aw access token
1:53
variable so the access token is ready
1:56
next I'm going to create a conversation
1:57
ID in order to get this conversation ID
2:00
I'm going to make use
2:03
of uu ID in
2:09
Salesforce I'm going to make use of uu
2:11
id. random uu ID to generate the
2:15
conversation ID in
2:18
Salesforce so this is the sample uu ID
2:23
so I'm making going to make use of this
2:25
as the conversation ID here
2:30
so the conversation is
2:33
created now I'm going to
2:36
subscribe to the server side
2:40
events so it got connected next I'm
2:44
going to send a message to invoke
2:48
me already it would have
2:55
invoked the agent force let's verify
2:58
that
3:03
so my agent force is already initiated
3:07
let me send a
3:11
message since this is going to be the
3:13
first message this particular uh in
3:17
reply to message should be
3:19
blank and this is the conversation ID
3:22
which we used it to create the
3:27
conversation for each and every message
3:29
we have to generate a message ID for
3:32
that I'm going to use the same uh uu
3:38
ID random uu ID
3:41
method so I'm going to make use
3:44
of this as my message
3:55
ID I'm going to send a message stating
3:58
that
4:00
order booking
4:05
for test
4:08
contact
4:09
test.com so this is the message I'm
4:12
going to
4:17
send it should be available here also so
4:21
order booking for test contact now in
4:23
order to find out what is the response
4:26
we got let's go to the server side event
4:32
subscription so this is typing
4:37
indicator okay so this is also typing
4:41
indicator okay so we should see that
4:47
message okay so this is the message we
4:50
got it from the agent force we have the
4:52
following product families available for
4:54
booking digital or static which one
4:56
would you like to choose we should see
4:59
the same information here
5:03
also so this is the message that was
5:05
sent by the agent force agent so I'm
5:10
going to
5:12
send so for the previous message ID is
5:14
this
5:16
one so I'm going to use that
5:20
here and I'm going to select one as so
5:25
I'm going to send a message as one and
5:27
for the new message ID we can make use
5:30
of the same uu ID random uu ID to
5:34
generate
5:43
it so this is the new message ID I'm
5:46
going to
5:50
pass so this is also
5:56
done no okay so this is uh typing
6:00
indicator is stopped and the latest
6:03
message from the agent force agent is
6:06
awesome here are the cities where we
6:10
have products
6:11
available we should be able to see all
6:13
those conversation in the messaging
6:16
session record
6:18
also so we sent one it said awesome here
6:23
are the cities where we have products
6:26
available
6:28
so in this way we can definitely invoke
6:31
Salesforce agent force agent with the
6:35
help of Salesforce me messaging for inap
6:38
and web rest
6:45
apis please check the video description
6:48
in the video description I have shared
6:49
my blog post from the blog post you
6:52
should be able to get some sample
6:54
references with clear step bystep
6:58
instructions so that it will be easy for
7:00
you to set up and play
7:09
around I hope it was
7:17
helpful thank you for watching
#Internet Software
#Text & Instant Messaging