Appearance
Exercise 7 (Optional): Invoke a Prompt Template using the REST API
In this exercise, you’ll use Postman to invoke the prompt template through the Connect REST API, which is a common pattern for running prompt templates from external systems.
This exercise uses the prompt template from Exercise 6:
- Prompt Template API Name:
Generate_Storefront_Social_Posts - Input resource:
Input:storefront(aStorefront__crecord id)
Step 1: Set up Postman authentication
Navigate to Postman and sign in (or create an account).
Open the Salesforce Developers public workspace collection: Salesforce Platform APIs.
Fork the collection into your workspace.
Open the collection Authorization tab and click Get New Access Token.
Log into your org and click Allow Access.
Click Proceed, then click Use Token.
Copy the
instance_urlvalue returned by Postman.In the collection Variables tab, set the Current value of
endpointto yourinstance_urland click Save.
Step 2: Run the prompt template request
In the collection, open Connect > Einstein > Generate Response Based on Template.
In the Params tab, set the
PROMPT_TEMPLATE_API_NAMEpath variable to:Generate_Storefront_Social_Posts
In the Body tab, replace
<INPUT_PARAMS>with:json"Input:storefront": { "value": { "id": "A Storefront__c record Id from your org" } }Replace the id value with a real
Storefront__crecord id from your org.TIP
You can copy a record id from the URL of a Storefront record page.
Click Send.
Confirm the response includes a generated output that contains
twitter,linkedin, andslack_blockkit.
Summary
In this exercise, you invoked a Prompt Builder Flex template using the Connect REST API from Postman, which is a reusable approach for executing prompt templates from external systems.