Building Interfaces

Interacting with external apps via Membrane

When interacting with external apps through Membrane, you do it through Membrane Interfaces. Interfaces let you explore, structure, test, and troubleshoot integrations simpler and faster than hard-coding API requests into your product.

Choose interface type

Membrane provides a variety of integration interfaces for various purposes. Here are the most popular ones:

  • Actions are used for making synchronous requests or queries to external apps. If you are not sure which interface you need, you probably need an Action.
  • Data Collections are used to interact with data as if it was a database table. You can explore the data structures, read and write data, as well as subscribe to events. You can use Data Collections directly or through Actions/Flows.
  • Flows are used to trigger integrations when events happen in your app or in external apps. They also used for long-running or high-volume integrations that you want to put in a queue and process in the background.

For a full list of available interfaces see this article: Interfaces.

Choose integration layer

Depending on your use case, you build interface on one of the following layers:

  • Universal interfaces work consistently across multiple external applications. Use them when you want to apply the same integration logic or UI to multiple apps at once.
  • Integration-specific layer contains interfaces for a single External App. They can be implementations of universal interfaces or something unique to a given integration.
  • Customer-specific layer contains interfaces created for a specific Customer and Connection.
  • Ad-hoc interfaces are used to dynamically interact with external apps, usually based on real-time decisions made by AI.

Depending on your use case, you will create an interface on one of these layers, or, in case of ad-hoc interfaces, create a list of available options to be chosen from in the runtime.

Explore pre-built interfaces

In many cases, the interface you need already exists in Membrane. When you are adding an interface, you will see a list of options to choose from - you can use them as your interface or as a starting point for building your own.

Add to workspace

If none of the existing interfaces suit you needs, create a new interface of the type and on the layer you selected.

Refer to the documentation of your selected interface type to understand how to define it from scratch.

Test

After you created an interface, you should test it. You can do it via Console UI or by using the interface's API.

You should test two things:

  1. That interfaces runs with expected inputs and produces expected outputs.
  2. That interface does what it is supposed to do. You can usually check it by making additional requests to an external app to validate the effect of the interface you used - or by going to the application's UI.

Use in your code

When you are satisfied with the interface you've created, add it to your code. The best way to do it is to use code examples available for a given interface.

Examples will give you the exact code and/or API request you need to use interface in your codebase.