question

newuser-2d40f211-e22f-46e5-ba85-cbf9d6c0e128 avatar image

alexa:name usage in js

I was trying to read the first name of the person using the skill with the SSML tag of alexa:name.

I see that when I hard-code the personID, the skill works correctly:

var speechOutput = 'Hello, <alexa:name type="first" personId="amzn1.ask.person.AG5O55GEGNAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY"}/> how are you?';

However, when I try to use the same command with a variable in personId, I am not able to get it to work correctly. i.e.:


let person = requestEnvelope.context.System.person;

const personUniqueId = person.personId;

var speechOutput = 'Hello, <alexa:name type="first" personId=personUniqueId}/> how are you?'

I tried to wrap personUniqueId in double quotes, {} etc and none of them seem to work.

Any clues as to how to proceed?

skillaccount linkingskill builderjavascriptpersonalization
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

voiceuideveloper avatar image
voiceuideveloper answered

Try this

var speechOutput = `Hello, <alexa:name type="first" personId=${personUniqueId}/> how are you?`;


10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.