Make a web request
What is a web request?
A web request is a bit like sending a detailed letter to an address, asking for specific information to be sent back, or to ask the recipient to perform an action, and then waiting for their response.
When you use the internet, HTTP (Hypertext Transfer Protocol) acts as a set of rules for transferring files (text, graphic images, sound, video, and other multimedia files) on the web. In the context of a Pendula flow, we can use HTTP requests (Or, web requests) to perform tasks or get information, all while communicating with our customers; and fully automated.
How can I use web requests in Pendula?
Make a web request allows you to make HTTP requests (POST, PUT, PATCH, or GET) to external services during an experience.
You can send unauthenticated web requests, or save secure credentials in Integrations to authenticate your web requests. You can save a username/password, request header or bearer token.
Some examples of how Make a web request can be used include:
Creating and configuring a web request
- If needed, make sure to securely store the credential from the external service in the Integrations page. This credential will need to be referred to when we configure Make a web request node.
- When building your flow, drag and drop Make a web request node onto the canvas to the desired point where you want to make a web request. The configuration screen will appear automatically.
- In the Request details section, first select the HTTP request method you want to use for (
POST) The external service you are calling out to will inform you on what method is suitable.
- Enter the API endpoint URL – this is the address where you want to send the request to.
- In the Authentication section, select authentication type required.
- Select the previously stored secure credential. If the credential hasn't been added, you can add one in the Integrations page.
- In the Request headers section, you can choose to add headers if necessary.
- In the Request body section, you can select content type (JSON by default) and configure the request body payload using the property builder.
If you wish to build your own JSON payload using code, you can select the ellipses next to the property builder, and choose 'Convert to code'. Note that this action is not reversible, and you'll need to 'Reset' to get the property builder back.
Using 'GET': Validate payloads and use webhook merge fields
When using the 'GET' request type, data is received from the external service and is brought into the flow. You can reference this data using merge fields later in the flow.
To view these merge fields, simply copy the request body of the payload from the external service (not including headers) and paste into the sample payload field of Make a web request. The sample payload must be in JSON format (key value pairs, objects, arrays).
Here's an example of the request body of a payload, in JSON format: