Shopify
1. Introduction
Shopify is an e-commerce platform that lets merchants all over the world to build and customize online stores to sell their products. Yellow.ai offers an integration with Shopify. You can connect your Shopify store to your Yellow.ai account to offer the best support service to your customers.
Benefits
- Sell your store products
- Allow customers to track their orders
- Display customer details
- Trigger webhook events
2.Configure Shopify Integration
Step 1: Create Shopify store app
Login to your Shopify account.
Choose the store you want to create the app for.
Click Apps on the left sidebar and click App and sales channel settings.
Click Develop apps for your app store.
Click Create app.
Provide a name for your app and click Create app.
In the Admin API integration section, select the actions you want the Yellow.ai platform to perform. For a detailed help doc, see Custom apps section of the Shopify documentation.
You need to enable the following scopes in the Shopify Admin section.
- orders_create
- products_create
- orders_cancelled
- orders_fulfilled
- orders_paid
- refunds_create
- customers_create
- customers_update.
- write_scripts_tags
- read_script_tags
Go to API credentials section and copy the Admin API access token that is displayed during the app creation process on Shopify and the API secret key.
Step 2: Connect the Shopify Store App with Yellow.ai
Go to cloud.yellow.ai.
Go to the bot and navigate to Integrations.
Type shopify in the Search box, and select Shopify Shop from the list.
Scroll down to Add account and fill in the following fields.
- Give accoutn name: Provide a name to Shopify account to be connected.
- Shop Name: Name of your shop in Shopify. The shop name should be taken from the Shopify store URL, for example if the merchant store URL is yellowxyz.myshopify.com,the shop name would be yellowxyz.
- Admin API Access Token: Copy and paste this from your Shopify store (refer step 8). Please only enter the Admin API access token that is displayed during the app creation process on Shopify.
- API Secret Key: Copy and paste this from your Shopify store (refer step 8)
- Domain name: Domain name refers to the URL or web address that directs customers to your online store. For example, yellowxyz.myshopify.com.
Click Connect.
If the integration is successful, You can see the Shopify Shop app on the Integrations page. With this, the connection has been established between the integration app and your Shopify account.
Please ensure that you enter your store name exactly as it is in the Shopify account.
3. Manage Shopify from your bot
Go to your bot in Studio and navigate to the flow where you want to use the Shopify node.
As the first step, collect the customer information. Use the Question node to collect the order ID and store the response in a custom variable (static or dynamic value). Ensure you set the right data type for the variable.
Add a new integration node - Node > Integration > Shopify Shop.
Pass the collected value a varIn Parameters of action selected with the syntax
- Dynamic value: variables.{variable_name}
- Static value: {variable_name}
Use Show sample response to see all the details that the function can retrieve in the JSON format.
Store the response in a variable.
You can decide the info you want to display to the user. Use the Function node to customise that information in the Code tab. For example, in the previous screenshot, order details are stored in the variable order_details. order_details.order.name
4. Recieve Shopify events in your bot
Once you have set up the integration, you can use webhooks to receive notifications on events occuring in your store. You can trigger customised actions to those events.
For example, you can show order details to customers when they purchase from your Shopify store.
The following are the events supported in our out of the box Shopify integration:
Event | Description | Use Cases |
---|---|---|
shopifyNewOrder | A new order is created in the Shopify store. | Trigger actions when a new order is created in your Shopify store. For example, send order confirmation emails or update inventory. |
shopifyNewProduct | A new product has been added to the Shopify store. | Trigger actions when a new product is added to your Shopify store. For instance, update your product catalog, create product listings, or notify your team. |
shopifyOrderCancelled | An order is cancelled. | Use this event to handle order cancellations. You might want to update inventory levels, refund payments, or notify customers when their orders are canceled. |
shopifyOrderFulfilled | An order was fulfilled or completed. | Trigger actions when an order is fulfilled or completed. This event can be used to update shipping information, send shipping notifications to customers, or update your order status. |
shopifyOrderPaid | Payment made for an order. | Use this event to respond when a payment is made for an order. For example, you can mark orders as paid, send payment receipts, or update financial records. |
shopifyRefundCreated | A refund was created for an order. | Trigger actions when a refund is issued for an order. You can update financial records, notify customers about the refund, or adjust inventory levels. |
shopifyNewCustomer | A new customer is registered. | Use this event to respond when a new customer registers in your Shopify store. You can add them to your customer database, send welcome emails, or track customer acquisition. |
shopifyCustomerUpdate | A customer’s profile details have been updated. | Trigger actions when a customer's profile details are updated. You might want to keep your customer database up to date or send profile change notifications. |
shopifyCheckoutCreated | Order checkout is initiated in Shopify. | Respond when an order checkout is initiated in Shopify. This can be used to track the progress of orders and gather data about checkout behaviors. |
shopifyOrdersUpdated | Shopify order is updated. | Use this event to handle updates to existing Shopify orders. You can monitor order changes, adjust inventory, or notify customers about updates to their orders. |
shopifyCartCreate | A cart is created in Shopify. | Trigger actions when a cart is created in Shopify. This event can be used to track shopping cart activity, gather data on abandoned carts, or initiate cart-related marketing efforts. |
shopifyCartEmpty | A cart is deleted. | Use this event to respond when a cart is emptied in Shopify. You can update cart-related data, trigger follow-up actions, or analyze cart abandonment patterns. |
For use case guides on Shopify event-driven campaigns, click here.
5. Activate webhook events in your bot
From the bot configuration page, click Events hub > Integrations. You will see all the supported events.
Navigate to the event that you want to use in the bot, click the more options icon, and select Activate.
When configuring the bot flow, in the Start node, choose Event and select the event that you want to use from the drop-down list.
Configure the actions that you want to trigger. For details on creating a bot, see Studio documentation.
6. Use-cases
The following business use-cases are supported in this integrtion.
Get all collections (getAllCollections)
This function fetches all the available collections from shopify. However, to access this data, you need to enable all the relevant scopes for the custom app in Configure Storefront API scopes.
Sample json response object for getAllCollections
"collection_listings": [
{
"collection_id": 482865238,
"updated_at": "2022-02-03T16:53:36-05:00",
"body_html": "<p>The best selling ipod ever</p>",
"default_product_image": null,
"handle": "smart-ipods",
"image": {
"created_at": "2022-02-03T16:53:36-05:00",
"src": "https://cdn.shopify.com/s/files/1/0005/4838/0009/collections/ipod_nano_8gb.jpg?v=1643925216"
},
"title": "Smart iPods",
"sort_order": "manual",
"published_at": "2017-08-31T20:00:00-04:00"
}
]
}
Get products by collection (getProductsByCollection)
This function retrieves all the products under a specific collection from shopify using collection ID.
Parameter | Datatype | Example |
---|---|---|
collection_id | String | 76854321 |
Sample json response object for getProductsByCollection-
{
"products": [
{
"id": 632910392,
"title": "IPod Nano - 8GB",
"variants": [
{
"id": 808950810,
"product_id": 632910392,
"title": "Pink",
"price": "199.00"
}
]
}
]
}
Get product details (getProductDetails)
This function helps you retrieve the details of a specific product using the product ID.
Parameter | Datatype | Example |
---|---|---|
product_id | Number | 632910392 |
Sample json response object for getProductDetails -
{
"product": {
"id": 632910392,
"title": "IPod Nano - 8GB",
"product_type": "Cult Products",
"variants": [
{}
]
}
}
Get products by name (getProductsByTitle)
This function helps to retrieve the list of products with the specified title.
Parameter | Datatype | Example |
---|---|---|
title | String | Ipad Nano |
Sample json response object for getProductsByTitle -
{
"products": [
{
"id": 632910392,
"title": "IPod Nano - 8GB",
"variants": [
{
"id": 808950810,
"product_id": 632910392,
"title": "Pink",
"price": "199.00"
}
]
}
]
}
Get product variants (getProductVariants)
This function retrieves the list of all the variants of a product based on the specified product ID.
Parameter | Datatype | Example |
---|---|---|
product_id | Number | 632910392 |
Sample json response object for getProductVariants -
{
"variants": [
{
"id": 39072856,
"product_id": 632910392,
"title": "Green",
"price": "199.00",
"sku": "IPOD2008GREEN"
}
]
}
Get order details (getOrderDetails)
This function retrieves the details of an order using the specified order ID.
Parameter | Datatype | Example |
---|---|---|
order_id | Number | 632910392 |
Sample json response object for getOrderDetails -
{
"order": {
"id": 450789469,
"cancel_reason": null,
"cancelled_at": null,
"confirmed": true,
"email": "[email protected]",
"financial_status": "partially_refunded",
"fulfillment_status": null,
"name": "#1001"
}
}
Get orders by customer ID (getOrdersByCustomerId)
This function helps to retrieve the list of all the orders of a customer based on the specified customer ID.
Parameter | Datatype | Example |
---|---|---|
customer_id | Number | 632910392 |
Sample json response object for getOrdersByCustomerId -
{
"orders": [
{
"id": 450789469,
"email": "[email protected]",
"created_at": "2008-01-10T11:00:00-05:00",
"updated_at": "2008-01-10T11:00:00-05:00",
"total_price": "598.94",
"financial_status": "partially_refunded"
}
]
}
Get customer details by email (findCustomerbyEmail)
This function retrieves the details of a customer based on their email ID.
Parameter | Datatype | Example |
---|---|---|
String | [email protected] |
Sample json response object for findCustomerbyEmail -
{
"customers": [
{
"id": 207119551,
"email": "[email protected]",
"created_at": "2021-04-01T17:28:57-04:00",
"updated_at": "2021-04-01T17:28:57-04:00",
"first_name": "Bob",
"last_name": "Norman",
"orders_count": 1,
"total_spent": "199.65",
"last_order_id": 450789469,
"verified_email": true,
"phone": "+16136120707"
}
]
}
7. Run campaigns based on Shopify events
You can initiate campaigns based on Shopify events. To know more about it, click here.
8.Limitations
- You can fetch up to 50 products a time.
- You can use only 90kb of object size
- You can have upto 8 carousel images since you cannot input the Next option to see more products in the subsequent list.
Abandon cart option is not available.
9.Troubleshooting
Error: Your webhook is failing
Ensure you have enabled Shopify's event in Event Hub. If your webhook fails more than twice, it will be removed and your application will not receive any notifications.
10. Import Shopify template
Now that the connection has been established with the Shopify app, you need to import the Shopify template in your bot to use the predefined flows of the app.
To use Shopify shop template:
Navigate to the Marketplace and search for Shopify. You will see the Shopify e-commerce bot template.
Hover on the card and click +Use Template.
Select the bot where you want to import the template.
Click Use template. The template will start importing. Wait until the import is complete.
Open the Flows dropdown to see the new flows added to the bot.
11. Disconnect Integration
To remove this integration from your bot,
- On the bot configuration page, go to Integrations.
- Search for Shopify shop > Disconnect.