Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get started
Connect with Matter
Alexa Connect Kit
Add-ons
Certify
Resources
Skip to main content
If your skill supports voice-forward account linking, your skill must handle the following interactions with Alexa: To see the point in the flow at which your skill must do these tasks, see Flow for voice-forward account linking (LWA OAuth). For a walkthrough of how to implement voice-forward account linking, see Tutorial: Implement Voice-Forward Account Linking in Your Skill.

Implement a handler to request the task to initiate voice-forward account linking

In step 1 of the voice-forward account linking flow, your skill uses skill connections to request the Amazon-owned voice-forward account linking skill to perform a task. In this case, the task (AMAZON.AskForAccountLinking) for the Amazon-owned voice-forward account linking skill is to link the customer’s account. In skill connections terms, your skill is the requester, and the Amazon-owned voice-forward account linking skill is the provider. You must first determine when to begin the account linking experience. Then, to pass the control to the Amazon-owned voice-forward account linking skill, your skill must implement a handler to return a Connections.StartConnection directive as shown in the following example. The RESUME_SESSION flag means that Alexa passes control back to your skill when the task is complete. For details, see Request a task from a provider skill.

Implement a handler to get the response on the task to initiate voice-forward account linking

In step 3 of the voice-forward account linking flow, the voice-forward account linking flow completes. Your skill session with the customer resumes because you set the onCompletion flag in the skill connections request to RESUME_SESSION. Your skill receives the skill connection response in the form of a Tasks.CompleteTask directive in the following form.
The status object returned by the “Voice Forward Account Linking” skill can contain the following codes and messages.
StatusMessageAlexa response before transferring control to your skill
200User account was already linked
200User account is now linked
200User denied account linking request
200User hasn’t enabled skills personalization
200User isn’t the Amazon account owner
200User didn’t answer the account linking request
400Bad Request, request is invalid.
403Requester wasn’t allowed to invoke the provider
500Internal Server error
Your skill must also implement a handler to receive a skill connection response from the Amazon-owned voice-forward account linking skill, and use that response to appropriately continue the conversation for your customer based on the result of the voice-forward account linking flow. Keep in mind the following best practices:
  • Avoid re-initiating voice-forward account linking for a customer in the same skill session. In other words, don’t use the following handler to send the customer back into the voice-forward account linking experience. You can instead send an account linking home card to allow the customer to link their account at a later stage.
  • If a customer was not successfully linked after the voice-forward account linking flow, you should send a LinkAccount card that lets customers start the account linking experience from their Alexa app at a later time. For details about account linking cards, see Define a card for use with account linking.
  • After the customer’s account is successfully linked (that is, accountLinkingTaskStatus is LINKED), use the account linking accessToken to retrieve the LWA user_id. You can use the retrieved LWA user_id to determine whether you need to register the customer as a new customer within your system.
To receive the skill connection response on the AMAZON.AskForAccountLinking task, implement a handler of the following form.
Last modified on November 15, 2023