Use CRM Data in your Power Virtual Agent Voice Bot
Published: 2022-12-17 13:13:48

---
title: Use CRM Data in your Power Virtual Agent Voice Bot
published: true
series: 101 - Power Virtual Agents
date: 2022-12-17 13:00:44 UTC
tags: 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3bkg5rradwzsfcjwt0mr.jpg
canonical_url: https://the.cognitiveservices.ninja/use-crm-data-in-your-power-virtual-agent-voice-bot
---
Photo by <a href="https://unsplash.com/@andrewtneel?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Andrew Neel</a> on <a href="https://unsplash.com/photos/cckf4TsHAuw?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>

--- 
> You might have read my beginner level step-by-step kick-starters [to create your first (voice-) bot](https://the.cognitiveservices.ninja/build-your-first-voice-bot-with-microsoft-power-virtual-agent-3e71f8531c3a) and might have implemented [Caller ID detection](https://the.cognitiveservices.ninja/give-your-bots-a-voice) in your bot. Then this article is here to dig a little bit deeper and demonstrate how to use CRM data to personalize the customer journey within the bot.

## Motivation

With the integration capabilities of Power Automate, your Power Virtual Agents-based (voice-) bots can take the next step in your digital customer service journey. Using CRM data can be used to make automated voice bot conversations more personal and relevant to your customer. There is no need to annoy your customer and ask for details you already know. Automating repetitive processes frees human experts to take care of more complex tasks and customer interactions. Power Virtual Agents is not just another chatbot platform. It is part of a whole ecosystem with frontend, backend, and middleware layers to help you to do #morewithless and to speed up your digitalization journey.

## SharePoint List as a data source

In this guide, I will use a simple SharePoint list as a data source for your bot's "CRM" Data. Other data sources can be used accordingly.

Create a simple list with the following columns:

```
title, name, surname, phonenumber, customernumber

```
![Figure 1: Create list in a sharepoint](https://cdn.hashnode.com/res/hashnode/image/upload/v1671190171487/1nfpHFBlU.png)  
<figcaption>Figure 1: Create a list in SharePoint</figcaption>

## Power Automate flow to fetch customer data

Next, we create a new Power Automate flow to fetch the calling customers' data from the list; we use the caller's phone number - [we already extracted it from the channel data](https://the.cognitiveservices.ninja/give-your-bots-a-voice#heading-callercallee-ids) - as input for the flow.

![Figure 2: Create a action node with input and outputs](https://cdn.hashnode.com/res/hashnode/image/upload/v1671189927882/IXxhkOIgN.png)
<figcaption>Figure 2: Create an action node with input and outputs</figcaption>

First, we define "phonenumber" as an input in Power Automate

![Figure 3: Input variable](https://cdn.hashnode.com/res/hashnode/image/upload/v1671189969600/NXsDMQm5h.png)
<figcaption>Figure 3: Input variable</figcaption>
Next, we initialize four variables as temporary storage for our CRM data.
![Figure 4: Create four variables](https://cdn.hashnode.com/res/hashnode/image/upload/v1671190014292/sXbwETmjk.png)
<figcaption>Figure 4: Create four variables</figcaption>

Next, the "get details from (SharePoint) list" action fetches the calling customers' data.

![Figure 5: Get data from the SharePoint list](https://cdn.hashnode.com/res/hashnode/image/upload/v1671190081190/UINKr2kxN.png)
<figcaption>Figure 5: Get data from the SharePoint list</figcaption>

The Filter Query is to select the data of the calling customer. We use the phone number as an index.

```
phonenumber eq 'phonenumber'


 "value": [
      {
        "@odata.etag": "\"2\"",
        "ItemInternalId": "3",
        "ID": 3,
        "Title": "Mr",
        "name": "Holger",
        "surname": "Imbery",
        "phonenumber": "+49xxxxxxxxx",
        "customernumber": "4477",
        ....

}
]

```

The array we get as an output of that step will be used to append the created variables via "Apply to each".

![Figure 6: store sharepoint list data in string variables](https://cdn.hashnode.com/res/hashnode/image/upload/v1671190219290/ni5EFnpWF.png)
<figcaption>Figure 6: store SharePoint list data in string variables</figcaption>

## Usage of CRM Data

![Figure 7: make data globally visible](https://cdn.hashnode.com/res/hashnode/image/upload/v1671202819119/7RzZksOjp.png)
<figcaption>Figure 7: make data globally visible</figcaption>

![Figure 7.1: make data globally visible](https://cdn.hashnode.com/res/hashnode/image/upload/v1671202955326/QbdmE7gIb.png)
<figcaption>Figure 7.1: make data globally visible</figcaption>

The data we acquired from our SharePoint list is stored in "bot." variables; therefore, the variable and its content are available globally. It can be used in every (new) topic.

There is no need to ask for the following:

- name,
- surname
- title
- phone number
- customer number
- or all other information you find in your data sources.

You can use speaker verification systems like [Nuance Gatekeeper or Phonexia Voice Verify](https://techdocs.audiocodes.com/voice-ai-connect/#VAIG_Combined/speaker-verification.htm?TocPath=Bot%2520integration%257C _____ 8) to verify the user's identity. You will then have two factors, Caller ID and confirmed identity via voice.

## Assets

- [list](https://learn.microsoft.com/en-us/connectors/connector-reference/connector-reference-powerautomate-connectors) of all Power Automate connectors
- [list](https://learn.microsoft.com/en-us/connectors/connector-reference/connector-reference-microsoft-connectors) of all Microsoft published connectors
- [SharePoint Connector](https://learn.microsoft.com/en-us/connectors/sharepointonline/)