# Shopify
<br/>
<span '32px'="" marginright:="" style="{{" }}="">Conversations</span>
<span '32px'="" marginright:="" style="{{" }}="">People</span>

When you connect your Shopify store to Infobip with our Exchange App, you can:
  
- Sync your Shopify data to People so that you can use it in the Infobip applications that you use, like Moments, Conversations, and Answers. The Shopify integration with Infobip People captures both customer and events data. For example, you can create campaigns and increase conversion rates by reminding customers of items left in their shopping carts.
- Create Shopify Context Cards in Conversations to enable a full shopping experience so that agents can access the relevant eCommerce data, such as orders and related customer details without navigating to another tab.

## What you will need

- An Infobip account. Existing users need the Infobip account with the *Integrations Manager* permissions. Please contact your account manager to learn more.
- A custom app created in your Shopify store

If you don't have an Infobip account, check out how to [sign up](https://www.infobip.com/docs/essentials/getting-started/create-an-account).
  
To access the integration [Log in](https://portal.infobip.com/login/) to Infobip, go to **Exchange** and select **Shopify**.

## Set up authentication
  
To set up the authentication between Infobip and Shopify, you first need to create a custom app in Shopify. Once you have set up the app, you can then use the credentials to authenticate with Infobip.
  
### Create a custom app in Shopify [#create-a-custom-app-in-shopify-set-up-authentication]
  
To create an app in Shopify:

1. Access your Shopify account and go to **Settings > Apps and sales channels > Develop apps**
2. Click **Create an App**.
3. Add a name for the App and then click **Create App**. You now have an app that you can configure to work with Infobip.
4. Go to **Configuration > Admin API integration** and click **Configure**.
5. Add the following scopes:
    - Write_customers
    - Read_customers
    - Read_orders
    - Read_products
6. After adding the scopes, click **Save** and then go to the **API credentials** tab,
7. Under **Access tokens**, click **Install app**and confirm the installation. You can see the following items. You use these details and credentials to complete the connection with Infobip.
    - Shop name in the URL
    - Admin API Access Token
    - API Key

### Add the credentials to Infobip [#add-the-credentials-to-infobip-set-up-authentication]

1. Log into Infobip and go to **Exchange > Shopify**
2. Click **Add** and accept the Exchange Terms & Conditions. Next, you see a configuration page.
3. Select the **Credentials** tab and click **Add Credentials**.
4. Enter the **Shop name**, **API Key**, and **Password** (same as Admin API Access Token). The Shopify Webhook HMAC Secret is optional.
5. You can optionally verify credentials clicking on **Verify Credentials**.
6. Finally, click **Submit**.

## Using Shopify in People
  
The following steps show you how to integrate Shopify with the People module:

1. Make sure that you have used your Shopify credentials to authenticate with Infobip. See Set up Authentication.
2. Choose the sync process you wish to activate. For example, to sync Shopify customer data to People. In the **Shopify** app go to the **Integrations** tab. On **Shopify customers to people**, click the three dots menu and then click **Set Credentials**. You see the **Add credentials** window.
3. Map the data. Modify the field mapping to the attributes so that the customer data is stored in the correct fields.
    In the Shopify Integrations area under **Shopify customers to people**, click **Configure**. The mapping page opens with a basic initial mapping.
    In the left column, you can select the customer fields available in Shopify and map them to the fields available in People on the right.
    Click **Save** to update your changes. Once the data is mapped, you are ready to start the integration.
    In the Shopify Integrations area under **Shopify customers to people**click the three dot menu, and then **Activate**.
    In the initial run, all mapped data is synced. In additional runs, the sync updates only data that has been changed (i.e. new customers created in Shopify or existing data updated). The data sync runs every 3 minutes.
    The integration shows as active in the Shopify Integrations area. New Shopify customers are added to People as they are created in Shopify.
4. To handle data.
    - If you edit the mapping in an active integration, the data captured may be affected depending on *when*the mapping was configured. For instance, if the mapping is set before the customer is updated then the sync captures the data and update the customer in People. If the mapping is set after the customer sync it updates only new or updated people. It ignores the majority of records that do not contain the information even though it is available in Shopify.
    - When data is deleted in Shopify it is retained in People if it has already been stored. The data is not removed by the integration or when the integration is stopped. If you would like to remove the data from People you can manually delete it.

## Using Shopify in Conversations
  
An agent using Conversations may wish to access some information from their Shopify Store to support communication with a client. They may need to access details about the history of the orders and any related customer details about the order. To use Shopify in Conversations, you use the Shopify Context Card. For more information about Context Cards, see [Conversations setup](https://www.infobip.com/docs/conversations/conversations-setup).
  
The Shopify Context Card supports the ability to:

- View the full order history
- View customer information for an order

When an agent is in conversation with a customer, the context cards on the right side of the Conversation Work panel can provide additional information or context that supports the customer conversation. You can find the Shopify in the context cards list.
  
Context cards in the Conversations panel are activated by default. This means that you see all the available context cards, even if you have not configured the fields.
  
If you have not set up the authentication and your preferred field values, you see a **Configuration Pending** message. Follow the instructions in [Set up Authentication](https://www.infobip.com/docs/shopify#set-up-authentication) and configure the context card.

### Activate the Context Card [#activate-the-context-card-using-shopify-in-conversations]
  
Before using the Shopify Context Card, you need to activate it and configure the fields.

1. Log into Infobip and go to **Exchange** **> All Apps** **> Shopify**.
2. Go to the **Integrations** tab.
3. Click on the three dots over the Shopify Conversations Block card.
4. Select **Activate**.
5. **Choose the credentials** you want to use.

### Configure the Context Card [#configure-the-context-card-using-shopify-in-conversations]
  
Use the **Configuration** page to define which details are available to the agent in the Shopify Context Card in Conversations.

1. Go to the **Integrations** tab.
2. Click **Configure** on the Shopify Conversations Block card. You see the Shopify Context Card fields.
    The left column displays the available Shopify fields. In the right column, you can enter a label that displays in the Context Card to represent the Shopify field. There are two tabs for **Order information** and **Customer information**.
3. Map the fields for order information.
    - **Order card information** - Define the most relevant order information available to the agent. You can select a maximum of three fields.
    - **Order details information** - Define the order details available to the agent. By default, it is mandatory to define three fields. To add more fields, click **Add Field**. To remove a field, click the X on the right.
4. Map the fields for **Customer details information** - Define the customer details available to the agent. By default, it is mandatory to define three fields. To add more fields, click **Add Field**. To remove the field, click the X on the right.
5. Click **Save** to save the mappings.

### Supported channels [#supported-channels-using-shopify-in-conversations]
  
The Shopify Context Card is supported in Conversations through the following channels:

- Whatsapp
- SMS
- Voice
- Viber
- Email
- Instagram Messaging
- Facebook Messenger

