- 14 Apr 2022
- 4 Minutes to read
Post to Flow Handler Behavior
- Updated on 14 Apr 2022
- 4 Minutes to read
Post to Flow Handler is a behavior type that allows arbitrary data to be sent to a Flow via REST Integration by POST or GET methods.
Data utilized in a Post to Flow Handler does not nave have to conform to the contract obtained via the View Integration Details page. Flows using this Behavior can operate as a Named User; therefore, calls utilizing the Flow circumvent the need for specification of user credentials.
Typically, the REST Service API shows instructions for calling the Flow, as well as the Output. Post to Flow Handlers simply provide a URL for users to call on the Flow via API. Additionally, Post to Flow Handlers are designed to be very flexible; usually REST service calls require passing parameters to a Flow in a strictly structured XML encoded way. By contrast, Post to Flow Handlers are designed to post data into the Flow in a more simplistic "query key=value style", or through plain text format. As a Flow Designer, users handle the "Call Data" variable and make use of it in their Flow.
The Call Data variable can be viewed using the Data Explorer tab for the Flow.
Below is an overview of the CallData input fields and their type.
|Payload Data||String||A string field representing the body of the request|
|QueryString||DataPair||The query string representing the request in the URL|
|RawURL||String||The raw URL path of the request|
|RequestHeaders||DataPair||The request header used in the URL. This is typically either HTTP or HTTPS.|
|UserHostAddress||String||String field representing the address of the user|
|UserHostName||String||String field representing the name of the user|
|WasPost||Boolean||Boolean string value. If enabled, the request was submitted as a POST call.|
Begin in a Designer Folder by clicking Create Flow to create a new flow. From the 'Create Flow' panel, select Flow [Advanced], search for a Post to Flow Handler, and click 'Create'. Name the Flow, then click the 'Create' button to begin.
- After creating the Flow, begin by connecting the Start Step to the End Step. Then, navigate to the Properties tab on the right to find the Use Flow as Account setting. Click Pick and select an account to pass the desired authorization level to the API call. NoteUse Flow as Account allows a user to operate the Flow from Postman with the same permissions as the selected account.
- Search for and drag and drop in a Create Data step. Then, navigate to the Properties panel for this step and click Show Editor under Data to Create.
First name the Data Definition, then select String [Text] from the Type drop-down. Select From Flow map CallData.PayloadData to this data. This mapping will deserialize the body text from a Post call and turn it into a string that can be used in Decisions. 'Close' twice to save and exit the data editor.
Next, search for and add a Split String step; this step will serve as a way to separate data received from Post so that it can be used for individual parts of a data type. To configure the separator, select this step to navigate the Properties tab. Then, Constant map a comma as the separator, and Select From Flow map the output of the Create Data step to the Input for source.
Next, add another Create Data step after the Split String step; this step will act as a method of creating Account Info data that can be used in Decisions from the divided received Payload data. After adding this step, access the Data Definitions panel and create an AccountInfo [DecisionsFramework.ServiceLayer.Services.Accounts] data type.
Next, define the Input for this Datatype. From the Data Definitions panel, select Edit besides 'Input'.
Then, click the drop-down arrow besides 'Ignore' and choose Build Data.
Select From Flow map the Name property as SplitString1_Output.First, and the EmailAddress property as SplitString1_Output.Last. Mapping these properties will pass information from the Split up string into the newly created AccountInfo data type.
To ensure that the Flow is working as intended, add a Send Notification (Communication) step. From the Properties tab, click AddNew under NotifyUser to choose an account to receive the notification.
Merge Plain Text the Input for Message with the following parameters by adding the the data through way of the data panel on the left.
Save to save changes and close the editor; the inputs for Accounts and Groups, and Subject may be ignored.
- To begin configuring a Postman call, access the Integration Details for the Post Handler. From the Flow Designer, click the View button located in the top tool bar.
- From this screen, change the HTTP Method from GET to POST. Afterward, click Show Service API. This will display the URL required to make a call via Postman.
Copy this URL and open Postman. Click the Add button to create a new request in Postman. Next, to the left of the URL box, click the drop-down arrow and select the POST type. Afterwards, paste the corresponding URL to the Post handler, into the URL box.
Next, configure the POST body by clicking Body. After selecting Body, select raw from the input toolbar located underneath the URL toolbar.
Since this example only deals with the Payload data, the body only has to be a simple text input and does not require any further Postman configuration. In the input text field type a user's name and a comma. Then on a separate line of text, type in the user's email.