Name
Alexa Authentication 
Benefit
Allows voice-activated cross-platform experiences. For example, allows an audience member to ask Alexa to email them details or trigger a  response in TeamXp
  
Key Features
You decide on the tone and style of the connection process so that it's in keeping with your experience

You can authenticate Alexa users and connect their email addresses with their Alexa accounts. To do so, you need to set up an authentication method in Conducttr, and create a unique authentication code. The user will say this code to Alexa and Conducttr will connect the accounts.

The workflow is the following:

  1. The audience requests an authentication code by email.
  2. The audience receives an email with the code.
  3. The audience speaks the code to Alexa in order to link her email address with her Alexa account.
  4. Conducttr processes the code and merges the audience records containing the email address and the Alexa account.
  5. The audience receives a success message.

To create the authorization method, first you must have an Alexa Skill created and connected to Conducttr. Please check how to this in this article.


I.  Create authentication intent in Alexa

1. Create the intent to use for the authorization.




2. For this intent, you would need to set up a slot. This is how you can capture the number (code) the user will say to Alexa.

Click "Create a new slot" and give it a name. Choose the type: AMAZON.FOUR_DIGIT_NUMBER.


3.  Once you have created the slot, you can use it in the command.

Write how the user might invoke the intent, and type in the slot name between brackets ( { )

E.g. : my authorisation code is {my_number}


4.  When you're finished, click "Build Model".


II. Configuration in Conducttr


In Conducttr, you need to configure and prepare the project for the authentication.


1. First, make sure you have an Alexa account connected to Conducttr. Check how to do it here.

2. Go to "Attributes" and create an audience attribute, type: integer.




This is where you'll store the audience's authorization code.


3. Create a project attribute, type: inventory.



This is an array in which you'll store the audience hash, and their authorization code. This is the array that will use Conducttr to verify the codes when the Alexa trigger is fired.


4. Open the character's Alexa account and indicate the Alexa intent you created for the authorization. Indicate also the project array you created to store the codes.






III. Request code - Logic in Conducttr 


Now you have to prepare the logic in Conducttr to generate and send the code to your user.


1. Create an email trigger for when the user requests and authorization code:



2. For that trigger, create a "change value" action to generate the 4 digits code.

Store the code in the audience attribute you created, and select "Random value" of 4 characters:



3. Now save the hash and code you generated in the Project array. Use the generated code as the index, and the hash as the audience value:




4. Then, create an email content action to send the code to the audience, including the phrase they have to say to Alexa:


4. Your new Beat should looks like this:




IV. Merge accounts - Logic in Conducttr 


Finally, you have to build the logic to authenticate the account.


1. Create an Alexa trigger, parsing the code (slot).

The matchphrase for the trigger will be the intent your created, and the code to parse will be the slot.

E.g. : matchphrase = authorisation_code && my_number |parse('letters_numbers_latin') as my_number|


This will parse the code and store it into a temporary variable called my_number.

This method will automatically merge the accounts if the code is correct (if in the Project array, the code ans hash match). 
The method will also look for the code in the project array, and change the hash for a 1


After successfully merging an account, the array will look like this:





2. Now, add a condition that checks if the account has been successfully verified.

You'll know if the accounts were merged if the value for that code equals 1 in the project array.

Check if the project array in index "my_number" equals 1:



3. For that condition, create an Alexa content action with a success message



You can also add an email reply with a success message.


4. Add an "Else" condition and an error message from Alexa.

Click to add a new condition and select "ELSE"


Create your Alexa error message:



5. Your beat will look like this:





Once you finish, you can use the Alexa simulator to test the workflow.