Re: Use Third Party Integration using Shopify public app

Use Third Party Integration using Shopify public app

Faateh
Shopify Partner
17 0 1

I want to create a shopify public app where customers which are already subscribed to my software install this app and I could get their store's data in my software. But I'm unable to find out how to do it. Now I have used private app where I get the customer's stores secret key and access key due to which I could do third party integration. Now I want that using shopify public app. There would be some features which would be available in embedded app and some in my software. But I want to connect these two. How to do it? How to create communication between public app and software xyz? I tried creating API's in public app code template but was unable to call it in postman. The response would say "Shop is not given." Where to give shop Name. Kindly someone guide me as I'm stuck in it for days. 

Thank you in advance.

Replies 2 (2)

AppJetty
Excursionist
74 1 3

Hey,
To create a communication between your Shopify public app and your software, you'll need to follow these general steps:

 

Create a Shopify public app: Start by creating a public app in your Shopify Partners account. This will provide you with API credentials (API key and API secret key) that you'll use to authenticate and communicate with Shopify stores.

 

Install the public app in customer stores: Once you have the public app created, customers can install it on their Shopify stores from the Shopify App Store. During the installation process, they will grant permissions to your app to access their store's data.

 

Set up webhooks: Use webhooks to receive real-time notifications from Shopify when certain events occur in a customer's store (e.g., order creation, product updates). You can configure the webhooks in your public app's settings to specify which events you want to be notified about.

Handle OAuth authentication: When a customer installs your app, they will be redirected to your app's OAuth authorization page. After the customer approves the permissions, Shopify will send an authorization code to your app. You'll need to exchange this authorization code for an access token and a permanent refresh token, which you can use to make authenticated API requests on behalf of the customer's store.

 

Communicate with the customer's store: With the access token obtained through OAuth, you can make API requests to retrieve and modify data in the customer's store. Make sure to include the customer's store URL (e.g., https://example-store.myshopify.com) as part of the API requests to specify the target store.

 

Securely communicate with your software: To connect your public app with your software, you'll need to set up an API in your software that can receive data from Shopify. Ensure that your API endpoint is properly secured with authentication mechanisms such as API keys or OAuth tokens.

Trigger data synchronization: Depending on your requirements, you can use webhooks, scheduled tasks, or manual triggers to initiate data synchronization between the Shopify public app and your software. When a relevant event occurs in a customer's store (e.g., new order), you can send the corresponding data to your software through your API endpoint.

 

Regarding the specific issue you mentioned about the "Shop is not given" error when calling your public app's API in Postman, make sure you are passing the customer's store URL as a parameter in the API request. Typically, the store URL is passed as a query parameter or in the URL path, depending on how you've designed your API endpoints.

 

By following these steps and implementing the necessary API endpoints and authentication mechanisms, you should be able to establish communication between your Shopify public app and your software.

 

Improve your sales with AJ Delivery Date & Shipping
Faateh
Shopify Partner
17 0 1

I created shopify public app using yarn create @Shopify/app in the terminal as mentioned in the documentation. This gives you a code template with completed oAuth process and session token.
Now I created an API in this code template.
problem1.png

and this is how I called in postman
problem2.png

if I define this API above app.use("/api/*" , shopify.validateAuthenticatedSession) , it will give me the response but if I define below then it will give me the above error. What am I doing wrong?