|
1 | 1 | # Architecture |
2 | 2 |
|
| 3 | +The below documentation details the architecture of the Prompt Pulse solution. Prompt Pulse is provided as a Power Apps solution file (**unmanaged**), this allows easy updates when new versions are released. |
| 4 | + |
| 5 | +## Connectors |
| 6 | + |
| 7 | +The following connectors are used in the Prompt Pulse solution: |
| 8 | + |
| 9 | +- Viva Engage |
| 10 | +- Office 365 Users |
| 11 | +- SharePoint |
| 12 | +- Microsoft Teams |
| 13 | + |
| 14 | +When executed from the Power App (to retrieve Groups, Teams and Viva Engage communities) they will be executed in the context of the current user so they should only see ones they have access to. They will also only see group chats they are part of. |
| 15 | + |
| 16 | +The above connectors are also used in the Power Automate flows. |
| 17 | + |
3 | 18 | ## Power App |
4 | 19 |
|
5 | | -The Prompt Pulse Power App is a canvas app using mostly **modern** controls which provides an interface to share prompts directly, schedule the sharing of prompts and view prompts (all/recent/liked). |
| 20 | +The Prompt Pulse Power App is a canvas app using mostly **modern** controls where possible. Prompts that are shared/scheduled are stored in the **Prompts** SharePoint list. |
| 21 | + |
| 22 | +The app uses the above connectors to interact with the SharePoint site/lists and retrieve the locations in which to share the prompts. |
| 23 | + |
| 24 | +The app can be customized if you wish, though it's worth noting that customizations will be lost if you attempt to update the solution in the future when new releases are available. |
| 25 | + |
| 26 | +# Flows |
| 27 | + |
| 28 | +Detailed information about the flows used in the solution can be found below: |
| 29 | + |
| 30 | + |
| 31 | +## Send Prompt: |
| 32 | + |
| 33 | +Triggers when an item in the Prompts list is created or modified using the 'When an item is created or modified' SharePoint trigger. |
| 34 | + |
| 35 | +The following trigger condition is used to only trigger the flow when a prompt should be sent: |
| 36 | + |
| 37 | +```@equals(triggerBody()?['Status']?['Value'], 'Send')``` |
| 38 | + |
| 39 | +The flow uses a switch statement to switch on the value of the 'ShareLocation' column and based on the value, the relevant actions are used to post the adaptive cards/message in the Viva Engage community. |
| 40 | + |
| 41 | +The status of the list item is then updated to 'Sent'. |
| 42 | + |
| 43 | +**Please note - The cards and message will be sent AS the user whom you deployed the solution as. You may change the connections if you wish to change the user.** |
| 44 | + |
| 45 | +If the flow fails, a scope has been used to capture the error and the 'Status' column will be updated with the value **Failure**, you can then locate the flow and troubleshoot the error. |
| 46 | + |
| 47 | + |
| 48 | +## Send Scheduled Prompt |
| 49 | + |
| 50 | +Triggers on a recurrent schedule (default is 5 minutes). The flow retrieves all prompts that are scheduled to be sent by using the following odata query on the 'Get Items' action: |
| 51 | + |
| 52 | +```ScheduledDateTime lt '@{outputs('Current_datetime')}' and Status eq 'Not Sent' and Scheduled eq 1``` |
| 53 | + |
| 54 | +The remainder of the flow is the same as the **Send Prompt** flow. |
| 55 | + |
| 56 | +## Like Prompt |
| 57 | + |
| 58 | +This flow is triggered using the 'When someone responds to an adaptive card' trigger and is executed when the user clicks the 'Like Prompt' button in the adaptive card. |
| 59 | + |
| 60 | +The user responding to the adaptive card is retrieved from the 'Users' list and the prompt list item is retrieved from the 'Prompts' list. |
| 61 | + |
| 62 | +The flow then increments the value of the 'Likes' column by 1 and adds the prompt to an array. The value of the 'LikedPrompts' column in the Users list is checked to see whether it already contains the current prompt id. |
| 63 | + |
| 64 | +If this value does not exist, it is appended to an array and the value of the 'LikedPrompts' column in the Users list is updated. |
| 65 | + |
| 66 | +## Data Source |
| 67 | + |
| 68 | +As detailed in the [Overview](Documentation/Overview.md) documentation, there are 3 SharePoint lists used in prompt pulse. Please see the details of each list below and what each column is used for: |
| 69 | + |
| 70 | +### Prompts list |
| 71 | + |
| 72 | +| Column Name | Type | Used for | |
| 73 | +| -------- | ------- | ------- | |
| 74 | +| Prompt | Multiple lines of text | Storing the prompt text. |
| 75 | +| Likes | Number | Number of likes the prompt list item has. |
| 76 | +| ShareLocation | Choice | Location to share the prompt to. |
| 77 | +| Users | Person or Group (Allow multiple selections) | Users to share the prompt to. |
| 78 | +| TeamId | Single line of text | Id of the Team selected in the app to share the prompt to. |
| 79 | +| ChannelId | Single line of text | Id of the Channel selected in the app to share the prompt to. |
| 80 | +| GroupId | Single line of text | Id of the Group selected in the app (when sharing to Viva Engage). |
| 81 | +| GroupChatId | Single line of text | Id of the Group Chat selected in the app to share the prompt to. |
| 82 | +| MessageId | Single line of text | Unique id of the adaptive card message - used so we can refer back to it in Power Automate. |
| 83 | +| Scheduled | Yes/No | Whether or not the prompt has been scheduled. |
| 84 | +| ScheduledDateTime | Date and time | Date/Time to send the prompt. |
| 85 | +| Status | Choice | Status of the prompt. |
| 86 | + |
| 87 | +### Users list |
| 88 | + |
| 89 | +| Column Name | Type | Values | |
| 90 | +| -------- | ------- | ------- | |
| 91 | +| User | Person or Group | The user that has opened Prompt Pulse. |
| 92 | +| LikedPrompts | Lookup | The prompts that the user has liked. |
| 93 | +| TutorialComplete | Yes/No | Whether or not the user has completed the tutorial. |
| 94 | + |
| 95 | +### Configuration list |
6 | 96 |
|
7 | | -The app is fully responsive and works on mobile devices 📱 (please note that completion of the initial tutorial needs to be carried out on a desktop device). |
| 97 | +| Column Name | Type | Used for | |
| 98 | +| -------- | ------- | ------- | |
| 99 | +| Value | Single line of text | The configuration value. |
8 | 100 |
|
9 | 101 |
|
0 commit comments