Invoke Salesforce Prompt Template using REST API
771 views
Feb 4, 2025
To invoke the Salesforce Prompt Templates using REST API, we have to make use of Salesforce standard REST API endpoint available. Blog Post: https://www.infallibletechie.com/2025/02/invoke-salesforce-prompt-template-using-rest-api.html
View Video Transcript
0:08
hello everyone in this video we are
0:10
going to see how to invoke
0:14
Salesforce prompt template using rest
0:19
API we can make use
0:21
of Salesforce rest apas to invoke
0:26
The Prompt templates
0:31
in order to invoke the Salesforce rest
0:33
API I have created a Connected app in
0:37
the Connected app I have set the call
0:39
back URL as my Salesforce domain URL
0:45
slash Services
0:47
SL2 SL callback so this is my call back
0:52
Ur I will get the consumer key and the
0:56
Secret by making use of manage consumer
0:59
d details button so now I I have my
1:03
username password consumer key and
1:08
secret I created a sample uh prompt
1:13
template for this demo here I making use
1:18
of the prompt template to get a string
1:22
and then pass that into first name last
1:26
name and
1:27
email the extracted information
1:30
I wanted in Json format so I have
1:34
instructed The Prompt
1:37
Builder to get the extracted information
1:41
from the string in the Json format with
1:43
first name last name and email
1:46
address let's I have tested it here so
1:50
St Str request is a variable name when
1:53
we create a prompt uh template it will
1:56
ask the input variables so this is an
1:59
input variable the API name is St Str
2:02
request string
2:04
request here I'm using admin space user
2:07
my first name last name admin. user at
2:10
invaluable.com is a
2:12
sample dummy email address once I
2:17
previewed it it was able to give the
2:21
Json response with first name last name
2:23
and email address the same demo we are
2:26
going to see from the rest API
2:31
so the first step is we have to get the
2:33
access
2:34
token I'm using username and password
2:36
flow I'm passing the client ID secret
2:40
Grand type as password I'm using my
2:43
username password once uh this post
2:47
request is successful I will get the
2:49
access
2:50
token using a script I'm storing that in
2:53
Access token Postman
2:56
variable next you have to do a post to
3:00
request to your my domain URL slash
3:03
Services slash data slash the portion
3:06
number SL Einstein SL prompt temp prompt
3:11
ien templates slash the API name of the
3:16
prompt template SL
3:18
Generations
3:20
here the API name or the developer name
3:23
of my prompt template is parore person
3:26
unor
3:28
detail so here I have made use of the
3:31
API name of the prompt
3:35
template this is the request
3:38
body here I am passing the input
3:43
input colon s Str request this is my
3:46
input variable value the same value I'm
3:50
entering if I do a poster
3:54
request I should be able to get the same
3:57
information so the extracted information
3:59
is as follows so I'm able to get it in
4:02
Json
4:04
format so the same response what we
4:07
tested should be available when we
4:10
invoke it via Salesforce rest API
4:19
2 please check the video description in
4:22
the video description I have shared my
4:24
block post from the Block post you
4:26
should be able to get the sample
4:28
instruction
4:30
sample uh prompt template
4:34
setup sample uh body which was
4:39
used to invoke The Prompt
4:42
template you can make use of them as a
4:45
reference and then you can try it
4:55
out I hope it was helpful
5:03
thank you for watching
#Internet Software