Post to Flow Handler Behavior
  • 07 Jun 2023
  • 5 Minutes to read
  • Dark
    Light

Post to Flow Handler Behavior

  • Dark
    Light

Article Summary

Overview

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.

Data FieldTypeDescription
Payload DataStringA string field representing the body of the request
QueryStringDataPairThe query string representing the request in the URL
RawURLStringThe raw URL path of the request
RequestHeadersDataPairThe request header used in the URL. This is typically either HTTP or HTTPS.
UserHostAddressStringString field representing the address of the user
UserHostNameStringString field representing the name of the user
WasPostBooleanBoolean string value. If enabled, the request was submitted as a POST call.

Configuration

To configure the Post to Flow Handler, click on the Properties Panel and refer to the following table to configure the settings.

PropertyDescription
Allow GetEnabling allows calling the Flow via HTTP GET request.
Allow PostEnabling allows calling the Flow via HTTP POST request.
Return Results as JSONEnabling allows to return the data in JSON format.
Read Form DataWhen enabled, it allows to receive value in the FormData.
Note: Customers using FormData in their Flow must explicitly enable this option. Failure to do so will result in an inability to access the FormData property.
Use Named SessionAllows to pick a Named Session to call the Flow.
Use Flow as AccountThe specified account will be used to call the Flow.
Allow Local Machine to Run FlowWhen disabled, this will not allow running the Flow from the local machine.
Restrict By IP AddressSpecify an IP Address or list of IP Addresses to allow calling the Flow.

Example

  1. In a Designer Project, click CREATE FLOW, select ADVANCED, and select Post To Flow Handler. Name the Flow and click CREATE.
  2. On the Properties panel, click PICK under the Use Flow as Account field and select an account to pass the desired authorization level to the API call. 
    Using Flow as Account allows users to operate the Flow from Postman with the same permissions as the selected account.

  3. Attach a Create Data step from the Toolbox panel to the Start step. On the Properties panel, click SHOW EDITOR under the Data To Create field.
  4. In the Data Definition window, enter "AccountPostString" under NAME and select String [Text] as the TYPE. Click the pencil icon under INPUT. Change the mapping from Constant to Select From Flow. Click Call Data, select PayloadData, and click DONE. Click Save and close the window. This mapping will deserialize the body text from a Post call and turn it into a string that can be used in Decisions.
     
  5. Click the Done path and navigate to All Steps [Catalog] > Data > List. Select the Split String and click ADD. This step will serve as a way to separate the data received from the POST method so that it can be used for individual parts of a data type. On the Properties panel, enter "," for the Separator field, change the Source mapping to Select From Flow, and select AccountPostString.
  6. Attach a Create Data step to the Done path. This step will create Account Info data that can be used in Decisions from the divided received Payload data. Click SHOW EDITOR.
  7. Enter "NewPostAccounts" under NAME and select AccountInfo [DecisionsFramework...] as the TYPE.
  8. In the Data Definitions window, click the pencil icon under INPUT. Change the mapping from Ignore to Build Data. Map in SplitString1_Output.Last, for the EmailAddress field and map SplitString1_Output.First, for the Name field.
  9. Add a Show Popup step to the Done path. Enter "New Account" in the Subject field. Select Unknown next to Message, select Merge Plain Text, and click SHOW EDITOR.
       
  10. In the Merge Text Editor window, configure the Message to read "Email: [NewPostAccounts.EmailAddress] Name: [NewPostAccounts.Name]" by selecting the plus sign from the Data panel. Click SAVE.
     
  11. Connect the Done path to the End step. Click Save to save changes to the Flow.

Make REST Integration Call

  1. Click VIEW to open the Integration Details Page. 
  2. On the INFO tab, copy the 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. Paste the URL in the POST URL box.  
  3. Configure the POST body by clicking Body. Select raw from the input toolbar located underneath the URL toolbar. 
  4. Since this example only deals with the Payload data, the Body must be a simple text input and does not require any further Postman configuration. In the input text field, enter a name followed by a comma. On the next line, enter an email address. Click Send to submit the POST call. 

    Submitting the POST call will return a result for the Output underneath the Input box. Given that the Flow is configured to create AccountInfo data for Decisions, the Output will return as DecisionsFramework.ServiceLayer.Services.Accounts.AccountInfo; to verify the information is being received by the Flow, return to Decisions to see the notification received by the user. As configured, the notification displays the inputted email first and the user's name second, demonstrating that Decisions has created the AccountInfo data.
    Postman allows users to send a variety of body types, including JSON. Should a user send a POST call to Decisions, it will be deserialized into usable data for Decisions. 


 

Note
Postman allows users to send a variety of body types including JSON. Should a user send a POST call to Decisions, it will be deserialized into usable data for Decisions. 



Was this article helpful?