prodriguez

Shopify Connector Deep Dive

Blog Post created by prodriguez Employee on Jun 22, 2017

In this deep dive, we'll look at the Shopify connector to see how to configure it to work on the Boomi AtomSphere platform and then how to put it to work. New with the June 2017 release, this connector helps you create products, fulfill orders, and update fulfillment records on the Shopify ecommerce platform.

 

 

Glossary

Shopify is an e-commerce solution used to set up online stores and retail point-of-sale systems so that you can organize products, customize your storefront, accept credit card payments, and track and respond to orders. Before we start, there's some Shopify terminology we need to understand:

 

  • A product is an individual item for sale in a Shopify store.
  • A product variant is a different version of a product. Each size and color of a shirt, for instance, is a product variant.
  • An order is a customer's completed purchase request. An order is created when a customer completes the checkout process, in which he provides an email address or phone number, billing address, and payment information.
  • A fulfillment is a shipment of one or more items in an order. An order is completely fulfilled when all the items that make up that order have been sent to the customer.

 

Configure Shopify

If you're working through this deep dive with us, there's some setup to do in Shopify: create a store, associate an app to the store, set a redirect URL and then extract credentials.

  1. Register at Shopify Sign Up if you have not yet registered.
  2. Log in at the Shopify Partners Dashboard, then click the Partner login button in the upper-right corner.
  3. Create a new Shopify store if you have not created one. The following steps can be followed to create a Development Store, that could be upgraded to a real production store later:
    1. Click on the Development Stores menu item on the sidebar if you are not already on that page.
    2. Click on Create development store. bsp;This button is in the upper-right corner if you already have stores but on the main pane if you do not.
    3. Give the store a name, a password and set additional information appropriately.
    4. Click Save. Now you can manage your store in: https://store_name.myshopify.com/admin.
  4. Create a new App associated with the store:
    1. Click on the Apps menu item in the sidebar.
    2. Click Create app in the upper-right corner (in the main pane if you don’t have any apps).
    3. Give the app an App Name.
    4. Give the app an App URL of the form: https://STORE_NAME.myshopify.com/<app_name>
    5. Accept the developer agreement.
    6. Click Create app.
    7. Click Get API credentials.
    8. Add to the Whitelisted redirection URL(s) list the redirect URL associated with your Boomi account. The redirect looks like this:
         https://platform.boomi.com/account/<account_id>/oauth2/callback

      You can get your Account ID on Boomi AtomSphere by going to Setup > Account > Account Information.

    9. Click Save.
  5. Extract Authentication Data:
    1. Click the Apps menu item on the side bar.
    2. Select the App for which you want the credentials.
    3. Click the Get API credentials button.
    4. In the App credentials section, copy the values for the API key and the API secret key.

  

Configure the Connection component

Now that your Shopify account is set up, follow these steps to configure the connection component for the Shopify connector within AtomSphere.

  1. In the Connection tab, set the Store Base URL field as: https://STORE_NAME.myshopify.com
  2. For Authentication Type, leave the default value -- Shopify supports only the OAuth 2.0 authentication type.

 

 

On the OAuth 2.0 tab, perform these steps:

  1. Enter the Client ID value using the API Key.
  2. Enter the Client Secret value using the API Secret.
  3. Enter the Authorization Token URL value as:
       https://<store_name>.myshopify.com/admin/oauth/authorize
  4. Enter the Access Token URL value as:
       https://<store_name>.myshopify.com/admin/oauth/access_token
  5. Ensure that pop-ups are allowed on your browser.
  6. Click the Generate… button.
    A new browser tab opens with information about Shopify permissions.
  7. Click the Install App button. 
    In the new tab, a message indicates “Authorization Code received.”

 

 

Integrate Boomi with Shopify

Now that we’ve completed the setup, let’s build a process that uses it. The following processes use the Shopify connector to create a new product, create a new order with that product, and then fulfill that order.

 

Create a product

This process creates a Shopify product using a Message shape to pass a static value.

 

 

  1. Create a new process.
  2. Set the Start Shape as No Data.
  3. Add a new Message shape with these settings:
    1. For Message, enter {1}
    2. For Variables, add a new Parameter Value with:
          • Type: Static
          • Static Value:
      {
      "title": "BoomiTestProduct",
      "Vendor": "Dell",
      "Product_type": "Laptop"
      }

      Note: The title of the product is the unique required field. You can specify other fields, like body_html, images, tags, variants. Some examples in the Shopify documentation show product as a parent field with children fields. In this connector operation, there is no field on top of the others.

    3. Click OK.
  4. Add a new connector shape with these settings:
    1. For Connector, select Shopify.
    2. For Action, select CREATE.
    3. For Connection, create a new connection configured using the settings covered above.
    4. For Operation:
      • Create a new operation.
      • Click Import.
      • Select the Atom to run the import step, then click Next.
      • Select the Object Type: Product; then click Next.
      • Click Finish.
      • Click Save and Close.
  5. Click Save.
  6. Click Test.
  7. Select the Atom to run the process on.
  8. Click Run Test.

 

The product is now listed in https://STORE_NAME.myshopify.com/admin/products:

 

 

You get an output document that you can inspect by clicking the Stop shape at the end of the process:

 

 

The JSON result contains a default variant (the unique element in the variants array field) from which we will take the value of its id field:

 

 

Create a simple order

This process creates a new order that includes the product we just created:

 

 

  1. Create a new process.
  2. Set the Start Shape as No Data.
  3. Add a new Message shape with these settings:
    1. For Message, enter {1}
    2. For Variables, add a new Parameter Value with:
          • Type: Static
          • Static Value:
      {
          "line_items": [
              {
                  "variant_id" : 42366114756,
                  "quantity": 2
              }
         ]
      }

      Note: We extracted the value of the variant_id field from the result of creating the product in the last section. We could also obtain the value from the result of a GET or QUERY operation on Products. Here are other alternatives to specify the input for creating an order.

    3. Click OK.
  4. Add a new connector shape with these settings:
    1. For Connector, select Shopify.
    2. For Action, select CREATE.
    3. For Connection, create a new connection configured using the settings covered above.
    4. For Operation:
      • Create a new operation.
      • Click Import.
      • Select the Atom to run the import step, then click Next.
      • Select the Object Type: Order; then click Next.
      • Click Finish.
      • Click Save and Close.
  5. Click Save.
  6. Click Test.
  7. Select the Atom to run the process on.
  8. Click Run Test.

 

The order now appears listed in https://STORE_NAME.myshopify.com/admin/orders. The output document is a JSON object that contains an id field that we will revisit in the next section:

 

 

Create a fulfillment for a given order

Next, let's build a process that fulfills the order we just created:

 

 

  1. Create a new process.
  2. Set the Start Shape as No Data.
  3. Add a new Message shape with these settings:
    1. For Message, enter {1}
    2. For Variables, add a new Parameter Value with:
          • Type: Static
          • Static Value:
      {
         "order_id" : 5155536708,
         "tracking_number" : "1234546789",
         "tracking_company" : "China Post"
      }

      Note: The value of the order_id field is the value of the id field from the order created in the last section. You could also get the value from the result of a QUERY operation on Orders.

    3. Click OK.
  4. Add a new connector shape with these settings:
    1. For Connector, select Shopify.
    2. For Action, select CREATE.
    3. For Connection, create a new connection configured using the settings covered above.
    4. For Operation:
      • Create a new operation.
      • Click Import.
      • Select the Atom to run the import step, then click Next.
      • Select the Object Type: Fulfillment; then click Next.
      • Click Finish.
      • Click Save and Close.
  5. Click Save.
  6. Click Test.
  7. Select the Atom to run the process on.
  8. Click Run Test.

 

The order now appears fulfilled in https://STORE_NAME.myshopify.com/admin/orders. The output document is a JSON object that contains an id field that must be considered for the next section:

 

 

Update a fulfillment

Our goal now is to update the fulfillment we just obtained:

 

 

  1. Create a new process.
  2. Set the Start Shape as No Data.
  3. Add a new Message shape with these settings:
    1. For Message, enter {1}
    2. For Variables, add a new Parameter Value with:
          • Type: Static
          • Static Value:
      {
          "id" : 4437741700,
          "order_id" : 5166536708,
          "tracking_number" :  7777
      }

      Note: The value of the id field is the value of the id field from the fulfillment created in the last section; the value of the order_id field is the ID of the order previously created. You could also get those values by running appropriate QUERY or GET operations.

    3. Click OK.
  4. Add a new connector shape with these settings:
    1. For Connector, select Shopify.
    2. For Action, select UPDATE.
    3. For Connection, create a new connection configured using the settings covered above.
    4. For Operation:
      • Create a new operation.
      • Click Import.
      • Select the Atom to run the import step, then click Next.
      • Select the Object Type: Fulfillment; then click Next.
      • Click Finish.
      • Click Save and Close.
  5. Click Save.
  6. Click Test.
  7. Select the Atom to run the process on.
  8. Click Run Test.

 

This process generates the following output document, where the tracking_number and tracking_numbers fields now appear updated:

 

You can also see the updated tracking number in: https://STORE_NAME.myshopify.com/admin/orders/5166536708, where 5166536708 is the ID of the order that contains the modified fulfillment.

 

That’s our deep dive of Shopify. In a nutshell, we got our Shopify credentials and used them to set up our connection and operation, then we built processes that created a Shopify product, a simple order, a fulfillment, and updated that fulfillment. We hope that helps you get your processes up and running.

Outcomes