Custom Action

Support endpoints not natively built by Alloy Embedded

Overview

Alloy Embedded supports over 270+ blocks and thousands of individual endpoints. However, situations may arise where we don't have perfect endpoint coverage. Fortunately, Custom Action lets you use the underlying block's credential to configure your API endpoint.

How it Works

Let's assume Shopify has just added a new create order endpoint to their APIs and Alloy has yet to add support for that endpoint. With Custom Action, we can add this new endpoint to our workflow. To demonstrate, let's add an endpoint that allows users of your app to fetch all orders from their Shopify store.

Setting up your first Custom Action

  1. Start by setting up a trigger for your workflow.

  2. With the trigger set up, it's time to add Shopify to the workflow. To do so, head to the Destinations block. Then, click Shopify.

  3. Under block action, navigate to Create Custom Action.

  4. You'll be taken into the authentication tab where you can select authentication credentials you've previously added to Alloy. This credential will be used to generate output data for the workflow. In this example, we'll be able to select a Shopify account that we have linked to Alloy.

    Unlike the actions Embedded supports out of the box, you'll need a valid credential to build with Custom Action to generate valid output data.

  5. Next, we will select our Request Method and add our URL. This is where Shopify's API docs come in handy once more. We will use the POST method along with the endpoint highlighted in the screenshot below. We do not need to include anything before /orders as Alloy automatically adds the base URL prefix in all requests. This helps you save time when developing using custom action.


  6. Now, you're able to configure any additional query, header, and body parameters. Here's a look at the request body when using Custom Action to make a POST request to Shopify's "Create an order" endpoint.

Notice we did not include any authentication headers. This is because you have already authenticated your Shopify account within Alloy Embedded. Your authentication information will be sent alongside every API call from this block.

  1. You can test that everything works as it should by hitting the send request button and scrolling down to the Response window. Your response body should look something like below;

End-user configurability

Instead of adding it to the request interface, when using Custom Action, all end-user configurability is neatly controlled in Step 2. All parameters added, be it in the header, query, or body, will be available in Step 2 to make available for the end-user to configure with all the input settings you're used to.

Wrapping Up

In this article, we looked at how to make API calls to endpoints not yet supported by Alloy Embedded natively.