The Wix JavaScript SDK consists of npm packages containing wrapper functions for Wix REST APIs. These functions enable you to access and manage Wix functionality through function calls in your JavaScript code. When using the Wix JavaScript SDK, you only need to configure authentication once. You don’t need to handle it in every API call.
The Wix JavaScript SDK has two core modules - the SDK module (@wix/sdk
) and the React SDK module (@wix/sdk-react
).
The SDK module provides:
The React SDK module includes everything from the SDK module and enables the integration of Wix JavaScript SDK APIs within React components.
The Wix JavaScript SDK is easy to integrate into your app. You simply install a core module (@wix/sdk
or @wix/sdk-react
), and then backend modules for each Wix domain your app uses (such as @wix/contacts
.)
The Wix JavaScript SDK’s functions represent a simpler, cleaner alternative to REST API calls for Javascript developers.
It’s the natural choice if you’re building an app using the Wix CLI for Apps. The Wix JavaScript SDK is also a good option if you’re building a self-hosted app and coding in Javascript.
Your Javascript SDK API calls must be authenticated using the OAuth protocol. You can authenticate either as an instance of your app, or on behalf of a user. For more information, see About Authentication.
Site owners must also grant your app explicit permission to access their data. They do this when they install your app on their site. Therefore, you must provide a list of permissions you need from the site owner in the Permissions page in your app's dashboard. You can see which permissions each endpoint requires in its Permissions Scopes section in the JavaScript SDK API reference.
Depending on the context of your code, you may need to elevate the method you want to call.
Read more about permissions.
When developing an app with the SDK, we recommend using one of Wix's native frameworks: Wix Blocks or the Wix CLI. These platforms provide a superior development experience for most use cases.
Apps developed using these frameworks are hosted on Wix's cloud services, so server management is handled by Wix. Authentication is much simpler for these Wix-hosted apps because you don't need to use a Wix Client to make API calls with the SDK.
However, if necessary, you also have the option of self-hosting your app outside of Wix.
In self-hosted apps, you need to handle server management yourself and use a Wix Client to call the SDK.
For more details see About Development Frameworks.
The JavaScript SDK offers functionality for processing Wix webhook events. For an example, see Handle Events With Webhooks.
To integrate service plugins (formerly SPIs) into your app, you need to implement REST endpoints. For more information, see Service Provider Interfaces.