While Outpost offers a Tenant User Portal, you may want to build your own UI for users to manage their destinations and view their events.
The portal is built using the Outpost API with JWT authentication. You can leverage the same API to build your own UI.
Within this guide, we will use the User Portal as a reference implementation for a simple UI. You can find the full source code for the User Portal here.
In this guide, we will assume you are using React (client-side) to build your own UI, but the same principles can be applied to any other framework.
To perform API calls on behalf of your tenants, you can either generate a JWT token, which can be used client-side to make Outpost API calls, or you can proxy any API requests to the Outpost API through your own API. When proxying through your own API, you can ensure the API call is made for the currently authenticated tenant using the API tenant_id parameter.
Proxying through your own API can be useful if you want to limit access to some configuration or functionality of Outpost.
The destination type schema can be fetched using the Destination Types Schema API. It can be used to render destination information such as the destination type icon and label. Additionally, the schema includes the destination type configuration fields, which can be used to render the destination configuration UI.
Destinations are listed using the List Destinations API. Destinations can be listed by type and topic. Since each destination type has different configuration, the target field can be used to display a recognizable label for the destination, such as the Webhook URL, the SQS queue URL, or Hookdeck Source Name associated with the destination. Each destination type will return a sensible target value to display.
To create a destination, the form will require three steps: one to choose the destination type, one to select the topics (optional), and one to configure the destination.
Using the destination type schema for the selected destination type, you can render a form to create and manage destinations configuration. The configuration fields are found in the configuration_fields and credentials_fields arrays of the destination type schema.
To render your form, you should render all fields from both arrays. Note that some of the credentials_fields will be obfuscated once the destination is created, and in order to edit the input, the value must be cleared first.
The input field schema is as follows:
type InputField = { type: "text" | "checkbox"; // Only text and checkbox fields are supported required: boolean; // If true, the field will be required description?: string; // Field description, to use as a tooltip sensitive?: boolean; // If true, the field will be obfuscated once the destination is created and should be treated as a password input default?: string; // Default value for the field minlength?: number; // Minimum length for the field maxlength?: number; // Maximum length for the field pattern?: string; // Regex validation pattern, to use with the input's pattern attribute};
Some destination type schemas have a remote_setup_url property that contains a URL to a page where the destination can be configured. Destinations that support remote URLs have a simplified setup flow that doesn't require instructions. For example, with the Hookdeck destination, the user is taken through a setup flow managed by Hookdeck to configure the destination.
The URL is optional but provides a better user experience than following sometimes lengthy instructions to configure the destination.
Each destination type schema has an instructions property that contains instructions to configure the destination as a markdown string. These instructions should be displayed to the user to help them configure the destination, as for some destination types, such as AWS, the necessary configuration can be complex and require multiple steps by the user within AWS.
Events are listed using the List Events API. You can use the topic parameter to filter the events by topic or the destination_id parameter to filter the events by destination.