How Dgraph Cloud Can Assist Your Customer 360 Goals
Tags: graphql, webdev, dgraph, customer360
Published: 2021-06-29 15:54:02

![Featured Image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qut44j9zvpzykpg1suwj.jpg)

Reaching the point where a project or initiative succeeds is exciting. However, the goal isn’t really to be successful. Instead, the objective is simply “wanting to be successful.”

Let’s use an example to put things into perspective.

Consider a scenario where you find yourself so excited after reaching an important milestone that you actually stop what you are doing to reach out to your spouse, friend, or loved one to share your most recent news. 

Did you get excited and want to reach out because of an easy opportunity that fell into your lap? Most likely, no. Instead, your excitement from the success is really the result of hard work paying dividends.

In actuality, the work started with an underlying desire to be successful. That trait was further ingrained in your soul and fueled by the passion of working on something you enjoy. With a solid foundation in place, a natural period of cultivation and refactoring led to you creating something of value that was completed successfully.

Regardless of what “it” is that was labeled “successful,” some ensuing customer bought into your passion and made the necessary connection to yield the partnership a “success.” I find it useful to think of “success” in the same way Pat Summitt described “winning.” Below is a paraphrased version of Summitt’s words, where I substituted winning for success:

> “Success is fun … yes. But success is not the point. Wanting to be successful is the point. Not giving up is the point. Not letting up is the point. Never being completely satisfied with what you have done is the point.“ - adapted from Pat Summitt’s definition of “winning” 

## Now the Hard Part Begins

While the thrill of riding the “endorphin high” and celebrating with others is an amazing experience, the reality is that the hardest challenges are now on your radar. You’ve won the customer … now the hardest part is keeping the customer.

You won this customer, ultimately, because they were interested in taking things in a new direction. While your product or service is amazing, it took action on the customer’s side to really start the sales process.  

So, what is keeping them from tossing your offering aside in favor of something newer?

Sound familiar?

## What is a Customer 360?

The best way to maintain a successful relationship with your customers is to have a full understanding of your customer. This “complete view of the customer” is commonly referred to as a Customer 360.

It is important to note that a Customer 360—that complete view of the customer—is from your perspective. This view is more than having an understanding on who your customer is, but includes information such as:

* interactions with your website or application services, using site tracking tooling
* gaining an understanding of support tickets logged by representatives of your customer
* monitoring of social media data

With a solid Customer 360 in place, you will naturally find yourself in the best position to meet the needs of your customer. This minimizes lost potential and closes the gap in understanding between you and your customer’s needs.

## How Dgraph Cloud Provides Value

In prior articles, I have provided examples of how Dgraph Cloud (formerly Slash GraphQL) provides a top-notch service platform to meet your analytical needs:

* [Building an Amazon-Like Recommendation Engine Using Slash GraphQL](https://dzone.com/articles/building-a-recommendations-engine-using-spring-boo)
* [Tracking the Worst Sci-Fi Movies With Angular and Slash GraphQL](https://dzone.com/articles/tracking-the-worst-sci-fi-movies-with-angular-and)
* [Creating a Twitter Graph Using Slash GraphQL](https://dzone.com/articles/creating-a-twitter-graph-using-slash-graphql)
* [Using Slash GraphQL to Create InstaMeme—A Meme Sharing App](https://dzone.com/articles/using-slash-graphql-to-create-instamemea-meme-shar)

Building upon the knowledge I have gained in writing these publications, I believe Dgraph Cloud is ideal for building a Customer 360 view. Here are some reasons why:

1. A graph database is the ideal choice for Customer 360 data, and Dgraph Cloud is the #1 graph database on GitHub.
2. Dgraph Cloud provides everything you need to get up and running quickly; you just provide the schema and the data.
3. Dgraph Cloud’s underlying architecture allows for continual iterations not only during the prototyping phase, but also as requirements change.
4. Dgraph Cloud offers lambda resolves—which utilize standard JavaScript—to perform advanced operations that assist in data gathering, transformation, and analysis.
5. Dgraph Cloud is designed to adapt to your evolving business demands in a manner which minimizes (or completely eliminates) downtime.

## Using Dgraph Cloud for Customer 360

Consider the following illustration, which provides a high-level overview of input sources for a 360 view of the customer:

![Existing Relationships](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h4ptomg26juv596bvtwi.png)

In this example, the customer interacts in the following manners:

* Utilizes applications and websites for which you can track site analytics
* Orders products from a catalog you maintain
* Reviews products about you or your products
* Creates support tickets when an issue arises
* Joins loyalty programs in exchange for discounts or even free services
* Mentions you or your products on social media

As noted earlier, these high-level examples represent the full view of the customer from your perspective.

## Data Integration and Transformation

A valid assumption is that each import source has data which is not in a graph database. In fact, most of these systems likely utilize a relational database, which is geared toward performing transactions … and performing them quite well.

The key is to transform the payloads from these data sources in a way that brings value to Dgraph Cloud and the resulting Customer 360. With this in mind, the original illustration can be refactored as shown below:

![Graph Relationships](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3v9bna6ab38sp5mjtk5.png)

With this model in place, a simplified schema could be drafted as shown below:

```
type Customer  {
	id: ID! 
	name: String! 
      loyaltyPrograms: [LoyaltyProgram] 
      orders: [Order] 
	products: [Product] 
	supportTickets: [SupportTicket] 
	reviews: [Review] 
	siteDataResults: [SiteData] 
	socialMediaPosts: [SocialMedia] 
}

type LoyaltyProgram  {
	id: ID! 
	joined: DateTime! 
	level: Int! 
}

type Product  {
	id: ID! 
	name: String! 
	category: String! 
	price: Float! 
}

type Order  {
	id: ID! 
	products: [Product!] 
	amount: Float! 
}

type SupportTicket  {
	id: ID! 
	category: String! 
	status: String! 
	order: Order 
	product: Product 
	loyaltyProgram: LoyaltyProgram 
	summary: String! 
	created: DateTime! 
	lastUpdated: DateTime 
}

type Review  {
	id: ID! 
	product: Product! 
	rating: Int! 
	summary: String 
}

type SiteData  {
	id: ID! 
	category: String! 
	summary: String! 
	date: DateTime! 
}

type SocialMedia  {
	id: ID! 
	source: String! 
	tags: [String] 
	summary: String! 
	posted: DateTime! 
}
```

## Dgraph Cloud In Action

Upon inserting some sample data into the schema (which would normally arrive via Dgraph Cloud-driven integrations with external systems), the Data Studio view in Dgraph Cloud presents a high-level view of the customer:

![Data Studio](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvwvryytbqn9ted32e1y.png)

The Data Studio allows me to navigate through the data relationships with ease.  As an example, expanding the “siteDataResults” presents the following data:

![Site Data Results](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cw56hagc9q0mb1pujspa.png)

These results could be from analytical data captured during usage of customer-facing websites and ecommerce solutions.

The following example query could be created using Dgraph Cloud:

```
query MyQuery {
  queryCustomer(filter: {id: "0x28caba09"}) {
    id
    loyaltyPrograms {
      joined
      level
    }
    orders {
      amount
      products {
        name
        category
        reviews {
          rating
          summary
        }
      }
    }
    siteDataResults {
      date
      category
      summary
    }
    supportTickets {
      category
      summary
      status
    }
    socialMediaPosts {
      posted
      source
      summary
      tags
    }
    name
  }
}
```

Using sample data, the results may appear as shown below:

```
{
  "data": {
    "queryCustomer": [
      {
        "id": "0x28caba09",
        "loyaltyPrograms": [
          {
            "joined": "2020-01-01T00:00:00Z",
            "level": 3
          }
        ],
        "orders": [
          {
            "amount": 20.25,
            "products": [
              {
                "name": "Chelated Magnesium",
                "category": "health",
                "reviews": []
              }
            ]
          },
          {
            "amount": 21.5,
            "products": [
              {
                "name": "A&I Formula",
                "category": "health",
                "reviews": []
              },
              {
                "name": "Micellized Vitamin D3",
                "category": "vitamins",
                "reviews": [
                  {
                    "rating": 5,
                    "summary": "Great product, excellent taste!"
                  }
                ]
              }
            ]
          }
        ],
        "siteDataResults": [
          {
            "date": "2021-05-26T00:00:00Z",
            "category": "faq",
            "summary": "loyalty program not working"
          },
          {
            "date": "2021-05-25T00:00:00Z",
            "category": "loyalty",
            "summary": "join loyalty program"
          },
          {
            "date": "2021-05-24T00:00:00Z",
            "category": "potential-sale",
            "summary": "added A&I Formula to cart"
          },
          {
            "date": "2021-05-24T00:00:00Z",
            "category": "potential-sale",
            "summary": "added Chelated Magnesium to cart"
          },
          {
            "date": "2021-05-24T00:00:00Z",
            "category": "potential-sale",
            "summary": "added Micellized Vitamin D3 to cart"
          },
          {
            "date": "2021-05-24T00:00:00Z",
            "category": "potential-sale",
            "summary": "added Buffered Vitamin C to cart"
          },
          {
            "date": "2021-05-25T00:00:00Z",
            "category": "lost-sale",
            "summary": "removed Buffered Vitamin C to cart"
          }
        ],
        "supportTickets": [
          {
            "category": "loyalty",
            "summary": "Not getting free shipping option",
            "status": "closed"
          }
        ],
        "socialMediaPosts": [
          {
            "posted": "2021-06-02T00:00:00Z",
            "source": "twitter",
            "summary": "Loving the way I feel taking Micellized Vitamin D3 everyday!",
            "tags": [
              "#companyNameGoesHere",
              "#vitaminD3",
              "#health"
            ]
          },
          {
            "posted": "2021-06-01T00:00:00Z",
            "source": "twitter",
            "summary": "Who has the best price on Buffered Vitamin C?",
            "tags": [
              "#vitaminC",
              "#health",
              "#buffered"
            ]
          }
        ],
        "name": "John Doe"
      }
    ]
  }
}
```
By reviewing this data, the following discoveries could be made:

* While the customer is focused on healthy solutions, there is a strong preference for products that taste good.
* The customer is not happy with the Buffered Vitamin C product.
* There may be a bigger issue with being able to join a loyalty program and immediately using the free shipping option.

## Conclusion

Starting in 2021, I began focusing on the following mission statement which I feel can apply to any IT professional:

> “Focus your time on delivering features/functionality which extends the value of your intellectual property. Leverage frameworks, products, and services for everything else.”
- J. Vester

This mission statement provides direction and guidance on how best to reach the “success” interpretation inspired by Pat Summitt’s “winning” inspirational quote. Essentially: don’t lose your focus by trying to reinvent a solid solution which already exists.

Because “success” is tied to the desire to be successful, there is truly no end to this definition. In fact, one successful milestone is merely a signal to begin the next journey.

In this publication, we focused on maintaining the customer relationship—knowing it is a continual series of wanting to be successful. Using a Customer 360 approach provides multiple sources of data, helping you maintain a full view of the customer from your perspective.

Dgraph Cloud is an amazing SaaS solution which allows you to meet those needs. As a bonus, the service very much falls into my personal mission statement above by providing the platform for your feature teams to be successful.

Have a really great day!