Hi Adrian,
You can handle this directly inside a Hyper Flow by using the RestfulWebServices App. Since the example uses a JSON body with -d, I configured it as a POST request.
Here is the approach I used:
1. Create the required variables
Create OPENAI_API_KEY as a String variable.
Since this value is sensitive and rarely changes, you can enter the token in the Default Value field and hash it by clicking the lock icon next to the default value field. This is enough to store the value securely as a hashed variable.
Then create the dynamic variables you need for the request:
-
variable1
-
variable2
-
variable3
I also created output variables such as:
-
responseBody
-
responseHeader
These can be used to store the response returned by the POST call.
2. Assign values to the variables
After creating the variables, you can assign values to them inside the flow.
In my example, I assigned sample values manually, but in your real scenario these values will probably come from different sources such as the trigger payload, previous actions, or another data source.
For variable1, I added a few conditions so the flow can understand what type of data is coming in and assign the correct value accordingly.
For example:
-
variable1 can be assigned based on condition or cross-reference logic.
-
variable2 can come from a payload field.
-
variable3 can be constructed from payload fields as an object, then converted or escaped so it can be used as inline text inside the request body.
3. Configure the POST action
In the RestfulWebServices App, use the POST Method action and configure the URL, headers, and body.
URL
https://api.openai.com/v1/chat/completions
Headers
Content-Type: application/json
Authorization: Bearer ##OPENAI_API_KEY##
Body
You can build the JSON body by using the variables you created. For example:
{
"model": "##variable1##, value from cross reference.",
"messages": [
{
"role": "system",
"content": "You are an expert at ##variable2##"
},
{
"role": "user",
"content": "Please process following request: ##variable3##"
}
]
}
4. Capture the response
For the action output, I assigned the returned values to responseBody and responseHeader.
After the POST call is completed, you can check these values from the Monitoring logs and review the response returned by the API.
In your real flow, the variable values can come from trigger payloads, previous actions, conditions, or cross-reference logic. The important part is to prepare the variables first, then use them inside the POST action configuration.
Please let us know if you need a more detailed example for the cross-reference part or for constructing and escaping variable3.
Attachments
-
Hyper Flow JSON — RWS example
RWS Hyper Flow.json (21.7 KB)