While I was working yesterday on my desk, a new idea came up to my mind : Who is the last colleague having integrated the company !
Then, since I had just bought my new little friend 'Alexa' I asked her that question, and of course got no answer :/
This is where I thought of getting my new Alexa more intelligent, being able to answer correctly to my CRM recurrent questions at any time.
3 STEPS TO DO THAT!
1. Create a Power Automate (Flow)
Navigate to your CRM and create a new power automate flow (create a personnal one, not one included in a solution otherwise it won't work)
Click on My flows, + New , then choose "Instant-from blank".
Select the following trigger : "When an HTTP request is received"
Then copy and paste the following JSON in the trigger.
This code represents the structure of the call that Alexa will send to Microsoft Power Automate everytime we need to ask her about the CRM.
Now, add an action which is to List Records :
Pick the Environment & the concerned entity (in our case, "Users").
Order by the createdon field - decreasing (as shown in the image below).
And pick one record to show (the last one).
We need now to store the fullname value in a variable that we can send back to Alexa! :)
Let's add the "Initialize variable" action, and configure it as follow:
Now, we need to update this variable with the correct FullName. For this, add an"Apply to each" action that will iterate over the "List records" (we will only have 1 record in this list)
And add inside the Apply to each component a "Set variable" that will set it to the user's fullname.
Next, add the final step : HTTP Response
Insert the following body containing the variable : "User Fullname" in order for Alexa to read out loud your pre-configured sentence.
"The last colleague having integrated your company is... "
Then click on "Generate from sample" and paste the same body then click on Ok. That will generate the Response Body JSON Schema.
We're done with flow! Now save your flow and copy the URL generated inside the HTML trigger.
2. Configure Alexa
Navigate to the following URL: https://developer.amazon.com
Login or create a new account
Once connected, navigate to the following URL: https://developer.amazon.com/alexa/console/ask
Then create a new skill : (Click on "Create Skill")
Choose a name for your skill and the default language that you will be using to talk to Alexa requesting this skill. Once this is done click on "Create skill".
NB: Do not modify the custom model and default template at this stage.
Next, choose the "Start from scratch" template.
There you go!
We need to configure the 4 parameters included in the Skill builder checklist:
- Invocation name: "last user" in our example.
- Intents, samples and slots: specify what a user will say to invoke the intent
- Build model:
Pick the invocation name : "Last User"
Then, add a new custom intent as shown in the image below:
I picked "TheLastUser"(Yes that name has to be written without spaces)
Once your click on "Create custom intent", type samples of sentences that the User will say to Alexa in order to launch this intent.
Once you're done, save your work and click on "Build Model" then wait for a few minutes. A notification will inform you when the model has been successfully built.
Last step, specify the endpoint : This is where we will need to paste the Power Automate's URL copied earlier.
Select the "HTTPS" service endpoint.
Choose the same SSL certificate type as shown below and paste the flow's URL.
Now, click on "Save your endpoint".
The 3rd and most exciting step is testing! You can shoot the skill name to Alexa and wait for her response. :)
(Yes, you are ready to test your model directly on your Alexa device of course, the device should already be connected to the same amazon account)