Search for a command to run...
In this guide you'll learn about the Integration Module Provider: what it is, what it takes to implement one, how the module registers it at application start, and the data model that represents each registered instance in the database.
An Integration Module Provider declares an integration: its options, how they group into settings sections, and an optional connection test. A store admin configures it in the Admin, with no edits and no redeploy.
The Integration Module is provider-agnostic, so unlike Medusa's built-in commerce modules, it ships no default or placeholder provider of its own. Any plugin, provider, or custom module can be an Integration Module Provider. See Where It Can Be Used for the full range of cases.
Every provider registered in the Integration Module's option is represented in the database by the data model.
An Integration Module Provider is a module whose service extends , imported from . As with other Medusa module providers, a single module can register more than one Integration Module Provider service, each with its own , and each ends up as a separate provider.
declares the following members:
| Member | Description |
|---|---|
| Required. The provider's stable identifier, shared by every instance of it. | |
| Required, abstract. Returns the descriptor built with : the options, sections, validation, and optional connection test. | |
| Optional. A fail-fast check of the provider's configuration at load time. No-op by default. | |
| Implemented by the base class. Returns the constructor's . | |
| Implemented by the base class. Returns this instance's registration , or for the default instance. |
Here's the shape of a minimal provider, with every member from the table above in place except the ones the base class already implements:
providers/integration-my/services/my-integration.ts1import { AbstractIntegrationProvider } from "@gorgo/medusa-integration"23class MyIntegrationProvider extends AbstractIntegrationProvider {4 static identifier = "my"56 static validateOptions(options: Record<string, unknown>) {7 // optional fail-fast check8 }910 get descriptor() {11 return descriptor12 }13}1415export default MyIntegrationProvider
here is whatever returns, covered in General Concepts. and aren't shown: already implements both from the constructor's argument, so a subclass only adds , , and, optionally, .
See How to Create an Integration Module Provider for a full walkthrough with code.
The Integration Module accepts a option, where you configure the providers registered in your application, alongside the option used for the module's secret fields. See step 4 of How to Create an Integration Module Provider for the exact shape.
When the Medusa application starts, the Integration Module registers every provider listed in its option. For each entry, it combines the provider class's with the entry's own into the key , the same format used for that instance's in the database, then constructs the provider with .
A registered Integration Module Provider's instance is represented by the data model in the Medusa application.
The model's own is just its internal record id, generated like on any other Medusa data model. It is not the same as , the column that actually holds the key from Identifiers and Instances.
| Property | Description |
|---|---|
| The instance's key, . Unique. The CRUD API, the resolver, and the Admin all look up a row by this column. | |
| The integration's category, for example or , set from the descriptor's . | |
| The integration's display title, or when the descriptor doesn't set one. | |
| The integration's non-secret settings, as saved by the store admin. | |
| by default. Toggled from the Admin, see Enable and Disable an Integration. | |
| The result of the last connection test, , , or , or if it was never run. |
You can remove a registered Integration Module Provider by deleting its entry from the option in . Unlike disabling an integration from the Admin, this doesn't touch the stored row. It only stops the provider from being registered, so the module can no longer look up its row by . The integration disappears from the list in the Admin, and its stored data becomes unreachable through the Integration Module's own admin routes.
Delete the integration from the Admin before removing the provider from , not after. Once the provider is gone from the config, its row can no longer be reached, including through the delete route itself, so it stays in the database with no way to remove it from the Admin. See Delete an Integration for the normal deletion flow.
To stop a provider from being used while keeping its configuration intact and easy to bring back, disable it from the Admin instead of removing it from . See Enable and Disable an Integration.