Make a web request

Alex Pribula
Alex Pribula
  • Updated

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:

  • Retrieving Data: You might send a web request to get data from a database. For example, if you're looking at customer demographics, your request would ask for this specific information from the specified service (For instance, a CRM).
  • Sending Data: Similarly, you might need to send information, like updating customer records or posting content to social media. This involves sending a web request to the relevant service with the data you want to upload or modify.

Creating and configuring a web request

  1. 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.
  2. 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.make a web request.png
  3. In the Request details section, first select the HTTP request method you want to use for (GET , PUT , PATCH or POST ) The external service you are calling out to will inform you on what method is suitable.
  4. Enter the API endpoint URL – this is the address where you want to send the request to.
  5. In the Authentication section, select authentication type required.
  6. Select the previously stored secure credential. If the credential hasn't been added, you can add one in the Integrations page.
  7. In the Request headers section, you can choose to add headers if necessary.
  8. 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.

You can learn more about Pendula and merge fields here.

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:

"userid": "harrison-example",
"firstname": "harrison",
"lastname": "koenig",
"mobile": "+61400000000"

Screenshot 2023-10-16 at 10.03.02 am.png