Post to Flow Handler Behavior
  • 14 Apr 2022
  • 4 Minutes to read
  • Dark
    Light

Post to Flow Handler Behavior

  • Dark
    Light

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.

Example

About Example 
The following example demonstrates how to set up and utilize a Post to Flow Handler to make a call to Decisions via POST. 

  1. 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.

  2. 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. 

    Note
    Use Flow as Account allows a user to operate the Flow from Postman with the same permissions as the selected account.
  3. 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. 



  4. 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. 


  5. 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


  6. 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. 


  7. Next, define the Input for this Datatype. From the Data Definitions panel, select Edit besides 'Input'.

  8. Then, click the drop-down arrow besides 'Ignore' and choose Build Data. 

  9. 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.

  10. 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. 


  11. 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. 


  12. Before leaving the Flow Designer, configure the service settings, set it to API Service and allow the post method.

     

    'Save' and 'Close' the Flow.


Integration

  1. 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.

  2. 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. 



  3. 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. 



  4. 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.

  5.  Finally, 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.

 

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?