You are here:
Create a Flow to Activate Natural Language Processing Services
Create a flow in Flow Builder to activate Natural Language Processing Services and analyze text-based survey responses. This flow will invoke Natural Language Processing (NLP) actions when a survey is submitted.
- From Setup, in the Quick Find box, enter Flows, and then select Flows.
- Click New Flow, and select Record-Triggered Flow. Then click Create. Flow Builder launches.
- Click Edit.
- Select the object whose records trigger the flow when they’re created, updated, or deleted. Here, select the SurveyQuestionResponse object.
- Select when to trigger the flow. Here, select A record is created.
-
Next, add the element.
- Click the Toggle Toolbox.
- Click New Resource.
- Select Variable as the Resource Type.
- Enter an API name and description for the entity extraction.
- Select Apex-Defined as the Data Type.
- Select nlpservice_ServiceDetail as the Apex Class.
- Specify the availability outside the flow. Here, select Available for Input option.
- Click Done.
-
Similarly, create these variables:
Variables Data Type Apex Class Keyphrase Extraction Apex-Defined nlpservice_ServiceDetail Targeted Sentiment Apex-Defined nlpservice_ServiceDetail Service List Apex-Defined nlpservice_ServiceDetailsList -
Next, add a new element.
- Select Assignment.
- Click Edit Element.
- Select the Entity Extraction and configurationAPIName as variables.
- Select the operator as Equals.
- Select the value as AWS_Enity_Extraction.
-
Similarly, create these assignments:
Variables Operator Value Entity Extraction and serviceName Equals Amazon_Comprehend_Entity_Extraction ServiceList and serviceDetails Add EntityExtraction Keyphrase Extraction and configurationAPIName Equals AWS_Keyphrase_Extraction Keyphrase Extraction and serviceName Equals Amazon_Comprehend_Keyphrase_Extraction ServiceList and serviceDetails Add KeyPhraseExtraction Targeted Sentiment and configurationAPIName Equals AWS_Targeted_Sentiment Targeted Sentiment and serviceName Equals Amazon_Comprehend_Targeted_Sentiment ServiceList and serviceDetails Add TargetedSentiment -
In the flow, click Action.
- Click Industries Generative AI.
- Select Initiate Natural Language Processing as the action.
- Enter a label, API name and description.
- Select {!$Record.Id} as the Reference Record ID. (Reference Record ID> ID> SurveyQuestionResponse).
- Select {!ServiceList} as Service Details List.
- Select the Text Field value as SurveyQuestionResponse.ResponseValue.
- Click Done.
- Save and activate the flow.
The flow uses the Initiate Natural Language Processing action to call the Amazon Comprehend API, which analyzes survey responses and creates or updates records with insights about the responses.

