Build an httpHelper flow

This is an Early Access feature for existing Workflows users. To enable it, use the Early Access Feature Manager as described in Manage Early Access and Beta features.

The httpHelper flow manages two things for each action card that you’ll build in Connector Builder: authentication and any HTTP request. This is implemented in support of the Don’t Repeat Yourself (DRY) principle of software development aimed at reducing repetition of software patterns.

Create an httpHelper flow

  1. Create a new flow under the Flows tab by clicking + New Flow in the upper right corner of the page.

  2. At the far left of the page, click Helper Flow.

  3. Click Save in the toolbar and name the flow httpHelper.

  4. Add a description to the flow so other builders on your team know the purpose of the flow. For example: This flow manages all authentication and http requests for the connector.

  5. Check the box Save all data that passes through the flow, and click Save.

  6. Add the following input names and data types to the Helper Flow card by clicking on the area that reads Click or drag to create, add an input name, hit the enter key, then select a type from the drop-down that appears on the field itself.

    • relative_url (Text)

    • request_method (Text)

    • query (object)

    • headers (object)

    • body (object)

  7. Depending on the authentication type, you’ll next build out the series of cards that constructs your credentials into the proper objects for an HTTP call.

Option 1: Build OAuth authentication

  1. Add a Text Concatenate card to combine ‘Bearer ‘ with your access_token.

  2. In the text 1 field, enter Bearer .

    Caution

    Make sure to include the space in Bearer .

  3. Drag the access_token field from the Helper Flow card into the text 2 field on the Concatenate card.

  4. Name the output field bearer by clicking on the field’s dropdown and clicking customize. Note that the naming of these fields is a best practice and not a requirement.

  5. Add an Object Construct to the right of the Concatenate card.

  6. Click on the area that reads Click or drop here to create and add the label Authorization.

  7. Drag the bearer output field from the Concatenate function to this field. At this point, you can add any additional headers that will be shared between all HTTP requests to your service. For example, "Content-Type”: “application/json”

  8. Rename this output field header.

Option 2: Build basic authentication

  1. Add a Text Concatenate card to combine your username and password with separating colon.

  2. Drag the username field from the Helper Flow card to the text 1 input on the Concatenate card.

  3. Manually enter a colon : into the text 2 field on the Concatenate card.

  4. Drag the password field from the Helper Flow card to the Click or drop here to create area of the Concatenate card.

  5. Rename the output field of the Concatenate card to username_password or another defining name.

  6. Add a Text Base64 card, and drag the username_password field from the Text Concatenate card into the text input of the Base64 card.

  7. Rename the output field of the Base64 card to base_64.

  8. Add another Text Concatenate card to the flow.

  9. In the text 1 field, type Basic including the space.

    Caution

    Make sure to include the space in Basic .

  1. Drag the base_64 output from the Text Base64 card into the text 2 field of the second Concatenate card.

  2. Rename the output field of the second Concatenate card to auth_value.

  3. Add an Object Construct to the right of the second Concatenate card.

  4. Click on the area that reads Click or drop here to create and add a label named Authorization.

  5. Drag the auth_value output from the second Concatenate card to this field. At this point, you can add any additional headers that will be shared between all HTTP requests to your service. For example, “Content-Type”: “application/json”.

  6. Rename this output field header.

Option 3: Build custom (Api-key) authentication

  1. Add an Object Construct to the new flow (to the right of the helper flow).

  2. Click on the area that reads Click or drop here to create and add the name of the key to include in your header. For example, api_key.

  3. Drag the api_key (or whatever you named it when setting up your connector’s auth) from the Helper Flow card to this field. At this point, you can add any additional headers that will be shared between all HTTP requests to your service. For example, “Content-Type”: “application/json”.

Finish building an httpHelper flow

  1. Add an Object Merge card to your flow.

  2. Drag the header output from the Construct card into the object 1 field of the Merge card.

  3. Drag the headers output from the Helper Flow card into the object 2 field of the Merge card. This allows for the passing of any necessary endpoint specific headers.

  4. Rename the output field on the Merge card to merged_header.

  5. Add a Text Concatenate card to your flow.

  6. In the text 1 field, enter the base url for the flow without including a specific endpoint. For example, https://api.spotify.com/v1.

  7. Drag the relative_url field from the Helper Flow card into the text 2 field.

  8. Rename the output field on this card to full_url.

  9. Add an HTTP Raw Request card.

  10. Drag the full_url output field from the Concatenate card into the URL input of the Raw Request card.

  11. Drag the request_method output field from the Helper Flow card into the Method input of the Raw Request card.

  12. Drag the query output field from the Helper Flow card into the Query input of the Raw Request card.

  13. Drag the merged_header field from the Merge card into the Headers input of the Raw Request card.

  14. Drag the body field from the Helper Flow card into the Body input of the Raw Request card.

  15. To add these three fields to the Flow Control Return card, click on the area that reads Click or drop here to create:

  • status_code (Number)

  • headers (Object)

  • body (Object)

  1. Drag the corresponding outputs from the Raw Request card into these newly created fields.

  2. Save and test your flow by manually adding a relative url, request method, and any other request data to the test dialog.

Next steps

Build an _authping flow