|
| 1 | +--- |
| 2 | +title: Add chatbot to a page (Preview) |
| 3 | +description: Learn about how to add Power Virtual Agents chatbot to Power Apps portals page to answer questions using a bot. |
| 4 | +author: neerajnandwana-msft |
| 5 | +ms.service: powerapps |
| 6 | +ms.topic: conceptual |
| 7 | +ms.custom: |
| 8 | +ms.date: 05/18/2021 |
| 9 | +ms.author: nenandw |
| 10 | +ms.reviewer: tapanm |
| 11 | +contributors: |
| 12 | + - neerajnandwana-msft |
| 13 | + - tapanm-msft |
| 14 | +--- |
| 15 | + |
| 16 | +# Add chatbot to a page (Preview) |
| 17 | + |
| 18 | +[This article is pre-release documentation and is subject to change.] |
| 19 | + |
| 20 | +Power Apps portals allows you to add a [Power Virtual Agents chatbot](/power-virtual-agents/fundamentals-what-is-power-virtual-agents) to answer questions posted by a visitor on your portal page. A chatbot (bot) configured with different topics, and trigger phrases, can automatically respond to questions posted by a visitor in a chat conversation. |
| 21 | + |
| 22 | +> [!IMPORTANT] |
| 23 | +> - This is a preview feature. |
| 24 | +> - [!INCLUDE[cc_preview_features_definition](../../includes/cc-preview-features-definition.md)] |
| 25 | +
|
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +Before you add a Power Virtual Agents bot to a Power Apps portals page, you must create a bot first. If you don't have any available bots, you'll have the option in portals to go to Power Virtual Agents to create a bot. To learn about how to create a bot, go to [Create and delete Power Virtual Agents bots](/power-virtual-agents/authoring-first-bot). |
| 29 | + |
| 30 | +> [!IMPORTANT] |
| 31 | +> This feature requires the following versions for starter portal package and portal host: |
| 32 | +> - Portal host version [9.3.4.x](versions/version-9.3.4.x.md) or later. |
| 33 | +> - Starter portal package version [9.2.2103.x](versions/package-version-9.2.2103.md) or later. More information: [additional considerations](#additional-considerations) |
| 34 | +
|
| 35 | +## Add chatbot component |
| 36 | + |
| 37 | +To add a chatbot component to portal page: |
| 38 | + |
| 39 | +1. Go to [Power Apps](https://make.powerapps.com). |
| 40 | + |
| 41 | +1. Select **Apps** from the left pane. |
| 42 | + |
| 43 | +1. Select your portal. |
| 44 | + |
| 45 | +1. Select **Edit** to open the portals Studio. |
| 46 | + |
| 47 | +1. Select **Components** from the left pane. |
| 48 | + |
| 49 | +1. Select **Chatbot** component. |
| 50 | + |
| 51 | +  |
| 52 | + |
| 53 | +1. Select your bot. |
| 54 | + |
| 55 | +  |
| 56 | + |
| 57 | + > [!NOTE] |
| 58 | + > If you don't have a bot already created, or want to create a new bot to use in portals, select **Power Virtual Agents**. After you create bot, select **Sync configuration** inside portals Studio to reflect the bot changes. |
| 59 | +
|
| 60 | +1. Select whether the bot appears on all pages in your portal, or the selected pages. |
| 61 | + |
| 62 | +1. If you select **Specific pages**, use **Manage bots in pages** to control pages that can use this bot. |
| 63 | + |
| 64 | +You can add more bots from your environment across different pages in a portal. For example, a bot that answers questions related to workplace such as "Back to work" can be added to HR page. Or, a bot that answers to basic queries for payroll, such as "Payroll questions" can be added to Finance page. However, you can't have one page use more than one bot. |
| 65 | + |
| 66 | +## Advanced configuration |
| 67 | + |
| 68 | +Chatbot component is rendered using a web template called **Power Virtual Agents**. |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +You can change the values for the following parameters inside the "window.PvaEmbeddedWebChat.renderWebChat()" function. |
| 73 | + |
| 74 | +| Parameter | Value | |
| 75 | +| - | - | |
| 76 | +| width | Uses variable "chatWidth". To change width, update the width in pixel: <br> `let chatWidth = "320px";` | |
| 77 | +| height | Uses variable "chatHeight". To change height, update the height in pixel: <br> `let chatHeight = "480px";` | |
| 78 | +| headerText | Title of the bot. By default, uses the bot's name. To change, add "headerText" parameter with the bot header value: <br> `"headerText": 'Contoso chatbot';` | |
| 79 | +| webChatHeaderStyleOptions | Determines header style for the chatbot component, such as the color of font, and background. To change, update "webChatHeaderStyleOptions" parameter with the values for "fontColor", and "backgroundColor" properties: <br> `"webChatHeaderStyleOptions": {"fontColor":'black',"backgroundColor":'white',}` |
| 80 | + |
| 81 | +After changing the web template, ensure you select **Sync configuration** to update the configuration in open Studio session and reflect the changes. |
| 82 | + |
| 83 | +> [!NOTE] |
| 84 | +> Any changes to the Power Virtual Agents web template other than the parameters explained above are not supported. |
| 85 | +
|
| 86 | +## Additional considerations |
| 87 | + |
| 88 | +Consider the following when using Power Virtual Agents chatbot inside portals. |
| 89 | + |
| 90 | +### Portal template version |
| 91 | + |
| 92 | +This feature requires starter portal package version [9.2.2103.x](versions/package-version-9.2.2103.md) or later. If your portal template isn't upgraded to add support for chatbot component, you'll see following message when you try to add the component. |
| 93 | + |
| 94 | +"Portal upgrade required" <br> |
| 95 | +"An upgrade is required to use this feature on your portal. If you upgrade the portal, ensure you Sync Configuration to refresh your current portals Studio session with new portals package." |
| 96 | + |
| 97 | +When this message appears, upgrade your portal package. More information: [Update portals solution](admin/update-portal-solution.md) |
| 98 | + |
| 99 | +> [!NOTE] |
| 100 | +> Upgrading starter portal package will enable any additional portals in your environment with the capability to use chatbot component. More information: [Starter portal package updates](release-updates.md#starter-portal-package-updates) |
| 101 | +
|
| 102 | +### Solution deletion |
| 103 | + |
| 104 | +This feature comes with a portal solution called **MicrosoftPortalBot** with display name of **Dynamics 365 Portals - Bot**. Your portal will stop working if you delete this solution, and do not perform the following action. |
| 105 | + |
| 106 | +If you delete **MicrosoftPortalBot** solution, you must restart your portal to ensure the portal works correctly. |
| 107 | + |
| 108 | +To restart your portal: |
| 109 | + |
| 110 | +1. Open [Power Platform admin center](admin/admin-overview.md) for your portal. |
| 111 | +1. On the left-pane, select **Portal Actions**. |
| 112 | +1. Select **Restart** to restart the portal. |
| 113 | + |
| 114 | + > [!IMPORTANT] |
| 115 | + > Restarting the portal will make it unavailable for several minutes and users won’t be able to access the portal URL during this time.. |
| 116 | +
|
| 117 | +1. Select **Restart** to confirm restarting the portal. |
| 118 | + |
| 119 | +### See also |
| 120 | + |
| 121 | +- [Add the bot to your live website](/power-virtual-agents/publication-connect-bot-to-web-channels) |
0 commit comments