Creating Access Tokens
You can effortlessly generate online or offline access tokens for the Admin API using OAuth.
Making REST API Requests
The library simplifies sending requests to the REST API.
Making GraphQL API Requests
Easily execute requests to the GraphQL API within your app.
Register and process webhooks seamlessly with this library.
Once your app gains access to the Admin API, you can also utilize the Shopify Storefront API to run GraphQL queries using the unauthenticated_* access scopes.
This versatile library can be integrated into any application running on supported runtimes. It is not reliant on any specific framework, allowing you to include it alongside your preferred stack and only employ the necessary features for your app.
Please Note: While this package empowers your app’s backend to interact with Shopify APIs, you’ll need to use Shopify App Bridge in your frontend should you plan on embedding your app into the Shopify Admin.
To follow the usage guides provided below, you’ll need:
- Basic understanding of TypeScript
- A Shopify Partner account and development store
- OR a test store where you can create a private app
- An already set up private or custom app in your test store or partner account
- Ngrok installed (to create a secure tunnel to your localhost)
- Ngrok URL and appropriate redirect added to your app settings for OAuth callback route
To install this package, run the following command in your terminal:
npm install @programmatek/shopify-api-node
Please Note: Throughout the documentation, we will provide examples using the Express.js framework for simplicity. However, you can use the library with any framework of your choice, as mentioned earlier.
Begin by importing the adapter for your app’s runtime. This will automatically configure the library with the appropriate defaults and behaviors for the runtime.
Next, configure the library by providing the following values:
- Your app’s API key from the Partners dashboard
- Your app’s API secret from the Partners dashboard
- The required scopes for your app
shopifyApi (see reference) to create your library object before proceeding with setting up your app itself.
Once you have configured your app, you can leverage this package to access Shopify APIs. For detailed information on all the methods available in this package, please refer to the reference documentation.
Additionally, consult the Guides section for high-level instructions on obtaining API access tokens and utilizing them to query the APIs effectively.
As a general rule, apps typically interact with the Admin API to fetch or submit data to Shopify. To achieve this, apps need to:
- Create an Admin API access token through the OAuth flow.
- Set up their own endpoints to:
- Fetch the current session created during the OAuth process.
- Create a REST or GraphQL API client.
- Utilize the client to query the relevant Admin API.
Explore the following guides for detailed instructions on specific topics:
- Performing OAuth
- Storing sessions
- Setting up webhooks
- Using REST resources
- Configuring billing
- Adding custom runtimes
- Customizing logging configuration
- Setting up a custom store app
Migrating to v6
Prior to version 6, this library exclusively worked on Node.js runtimes. However, it now supports multiple runtimes through adapters, with the possibility of adding more over time. In the event that an adapter for your desired runtime is unavailable, you can create your own adapter by implementing key functions or contribute a Pull Request to this repository.
In addition to expanding runtime compatibility, we have improved the library’s public interface to simplify the loading of only the required features. If you are upgrading an existing app from version 5 or earlier, please consult the migration guide for version 6.