Invoke Salesforce Prompt Template using REST API

Invoke Salesforce Prompt Template using REST API

To invoke the Salesforce Prompt Templates using REST API, we have to make use of Salesforce standard REST API endpoint available.

Endpoint URL:

https://{Your Domain URL}/einstein/prompt-templates/promptTemplateDevName/generations

Sample Salesforce Prompt Template:

Prompt Template Instruction Used:

Your role is to parse the {!$Input:strRequest} and extract the first name, last name and email. The extracted information should be returned in JSON Format with firstName, lastName and emailAddress.

Sample API Request

Sample Request Body Used:

{
  "isPreview": "false",
  "inputParams": {
    "valueMap": {
      "Input:strRequest": {
        "value": "Admin User, [email protected]"       
      }
    }
  },
  "additionalConfig": {
      "applicationName": "PromptBuilderPreview"
  }
}

Developer Article:

https://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_prompt_template.htm

Leave a Reply