HTTP

Call

Performs an HTTP request, returning the result of this request and the response headers.

On input, takes a required URL input and optional auth, header, body, and query inputs. Each optional input can either be modeled by a singular object-typed input or by multiple keys with the appropriate group attribute. On output, returns an object with two keys, headers and output.

The output key contains the response body, and the headers key contains the response header. More detailed information can be accessed about these by using multiple keys with the appropriate grouping.

Input Fields

  • (Optional) body: The body being passed with the HTTP request.
  • (Optional) headers: The headers being passed with the HTTP request. If Basic Authentication is defined in the Authentication section of your Connector, you do not need to set an “Authorization” header, as it will be automatically sent for you. See “Authorization” in the documentation for more information. Can only be an object, or a reference to an object (with Mustache).
  • (Optional) query: The query passed with the HTTP request. Can be a string or an object.
  • filterEmpty: A boolean value determining whether or not to filter out all “null” and “undefined” values from your HTTP request.
  • method: The method of the HTTP request. Can be “GET”, “PUT”, “POST”, “DELETE”.
  • url: The url for the HTTP request.

Output Fields

  • rawBody: The response, in raw form, from the service.
  • statusCode: The status code response from the service.

Close

This module allows you to close out an HTTP connection and send a response back to the service, while continuing the rest of your method. This module is particularly useful for “user-invokable” invokable events, since often services that will be invoking a user’s Flow will require a specific response to stop further requests (for more information about invokable Flows, check out this guide). This allows you to build in the response to your connector, rather than relying on a user to end a Flow with a specific “Return Raw” card. Note, this module will only work if you are specifically using “user-invokable” invokable Flows, designated by the “user-invokable” flag being set to true at the top level.

Inputs

  • statusCode: The status code you would like to pass along to the service who invoked your connector.
  • headers: The headers you would like to send back to the service that invoked your connector
  • query: The group of query parameters you would like to send back to the service that invoked your connector.
  • body: The body of the response you would like to send back to the service that invoked your connector.

Outputs

There are no outputs for this module. It simply closes out the connection using the information provided.

Example

As an example, Salesforce’s Outbound Messaging allows you to set an endpoint to trigger whenever their own conditions are met internally. This is a perfect case for “user-invokable” connectors, because Salesforce will be triggering a Flow for you, and requires an acknowledgment response to know that the trigger was received.  Since we can’t assume that Flow builders will always end their Flows with a Return Raw card, set with the exact response format that Salesforce expects, we can’t expect the Salesforce HTTP connection to be correctly closed unless we perform it ourselves inside of the invokable method. Salesforce’s acknowledgment response is required to look like this: Status Code: 200 Headers: { “Content-Type”: “text/xml” } Body:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:out="http://soap.sforce.com/2005/09/outbound">
    <soapenv:Header/>
       <soapenv:Body>
          <out:notificationsResponse>
              <out:Ack>true</out:Ack>
          </out:notificationsResponse>
       </soapenv:Body>
    </soapenv:Header>
</soapenv:Envelope>

So, we know that inside of our connector we’ll need to send out this response, using the HTTP.Close card. Here’s what that would look like, with “XMLBUILD.output” being the output of an XML.Build module that contains the above XML.

{
   "brick": "http.close",
   "id": "Byxw3",
   "inputs": {
      "statusCode": {
        "_type": "number",
        "_array": false,
        "_value": 200
      },
      "query": {
          "_availableTypes": [
             "object",
             "string"
          ],
         "_type": "object",
         "_array": false,
         "_value": {}
      },
      "body": {
         "_availableTypes": [
           "object",
           "string"
         ],
         "_type": "object",
         "_array": false,
         "_value": "{{XMLBUILD.output}}"
       },
       "headers": {
         "_type": "object",
         "_array": false,
         "_value": {
           "Content-Type": "text/xml"
         }
      }
   },
  "outputs": {}
}

Delete

Performs an HTTP DELETE request, returning the result of this request and the response headers.

On input, takes a required URL input and optional auth, header, body, and query inputs. Each optional input can either be modeled by a singular object-typed input or by multiple keys with the appropriate group attribute.

On output, returns an object with two keys, headers and output. The output key contains the response body, and the headers key contains the response header. More detailed information can be accessed about these by using multiple keys with the appropriate grouping.

Input Fields

  • (Optional) body: The body being passed with the HTTP request.
  • (Optional) headers: The headers being passed with the HTTP request. If Basic Authentication is defined in the Authentication section of your Connector, you do not need to set an “Authorization” header, as it will be automatically sent for you. See “Authorization” in the documentation for more information. Can only be an object, or a reference to an object (with Mustache).
  • (Optional) query: The query passed with the HTTP request. Can be a string or an object.
  • filterEmpty: A boolean value determining whether or not to filter out all “null” and “undefined” values from your HTTP request.
  • url: The url for the HTTP request.

Output Fields

  • body: The body of the HTTP response.
  • statusCode: The status code response from the service.

Get

Performs an HTTP GET request, returning the result of this request and the response headers. On input, takes a required URL input and optional auth, header, body, and query inputs. Each optional input can either be modeled by a singular object-typed input or by multiple keys with the appropriate group attribute. On output, returns an object with two keys, headers and output. The output key contains the response body, and the headers key contains the response header. More detailed information can be accessed about these by using multiple keys with the appropriate grouping.

Input Fields

  • (Optional) body: The body being passed with the HTTP request.
  • (Optional) headers: The headers being passed with the HTTP request. If Basic Authentication is defined in the Authentication section of your Connector, you do not need to set an “Authorization” header, as it will be automatically sent for you. See “Authorization” in the documentation for more information. Can only be an object, or a reference to an object (with Mustache).
  • (Optional) query: The query passed with the HTTP request. Can be a string or an object.
  • filterEmpty: A boolean value determining whether or not to filter out all “null” and “undefined” values from your HTTP request.
  • url: The url for the HTTP request.

Output Fields

  • body: The body of the HTTP response.
  • statusCode: The status code response from the service.

Post

Performs an HTTP POST request, returning the result of this request and the response headers. On input, takes a required URL input and optional auth, header, body, and query inputs. Each optional input can either be modeled by a singular object-typed input or by multiple keys with the appropriate group attribute. On output, returns an object with two keys, headers and output. The output key contains the response body, and the headers key contains the response header. More detailed information can be accessed about these by using multiple keys with the appropriate grouping.

Input Fields

  • (Optional) body: The body being passed with the HTTP request.
  • (Optional) headers: The headers being passed with the HTTP request. If Basic Authentication is defined in the Authentication section of your Connector, you do not need to set an “Authorization” header, as it will be automatically sent for you. See “Authorization” in the documentation for more information. Can only be an object, or a reference to an object (with Mustache).
  • (Optional) query: The query passed with the HTTP request. Can be a string or an object.
  • filterEmpty: A boolean value determining whether or not to filter out all “null” and “undefined” values from your HTTP request.
  • url: The url for the HTTP request.

Output Fields

  • body: The body of the HTTP response.
  • statusCode: The status code response from the service.

Put

Performs an HTTP PUT request, returning the result of this request and the response headers. On input, takes a required URL input and optional auth, header, body, and query inputs. Each optional input can either be modeled by a singular object-typed input or by multiple keys with the appropriate group attribute. On output, returns an object with two keys, headers and output. The output key contains the response body, and the headers key contains the response header. More detailed information can be accessed about these by using multiple keys with the appropriate grouping.

Input Fields

  • (Optional) body: The body being passed with the HTTP request.
  • (Optional) headers: The headers being passed with the HTTP request. If Basic Authentication is defined in the Authentication section of your Connector, you do not need to set an “Authorization” header, as it will be automatically sent for you. See “Authorization” in the documentation for more information. Can only be an object, or a reference to an object (with Mustache).
  • (Optional) query: The query passed with the HTTP request. Can be a string or an object.
  • filterEmpty: A boolean value determining whether or not to filter out all “null” and “undefined” values from your HTTP request.
  • url: The url for the HTTP request.

Output Fields

  • body: The body of the HTTP response.
  • statusCode: The status code response from the service.