- Implement a handler to request the task to initiate voice-forward account linking.
- Implement a handler to get the response on the task to initiate voice-forward account linking.
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 theonCompletion 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.
status object returned by the “Voice Forward Account Linking” skill can contain the following codes and messages.
| Status | Message | Alexa response before transferring control to your skill |
|---|---|---|
| 200 | User account was already linked | |
| 200 | User account is now linked | |
| 200 | User denied account linking request | |
| 200 | User hasn’t enabled skills personalization | |
| 200 | User isn’t the Amazon account owner | |
| 200 | User didn’t answer the account linking request | |
| 400 | Bad Request, request is invalid. | |
| 403 | Requester wasn’t allowed to invoke the provider | |
| 500 | Internal Server error |
- 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
LinkAccountcard 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,
accountLinkingTaskStatusisLINKED), use the account linkingaccessTokento retrieve the LWAuser_id. You can use the retrieved LWAuser_idto determine whether you need to register the customer as a new customer within your system.
AMAZON.AskForAccountLinking task, implement a handler of the following form.

