Check User's Device and apply condition accordingly

How to check from which device user is requesting, is it a phone, echo, or any other device and apply condition according to it. If the user is requesting from mobile then serve with cards and if the request is from echo then don’t.
if {devicetype} == ‘mobile’ - serve with cards
if {devicetype} == ‘echo’ - serve with audio

Thanks in advance.

You can use this code in the Code Block:

hasDisplay = voiceflow.capabilities && ('Alexa.Presentation.APL' in voiceflow.capabilities);

You need to declare the hasDisplay variable in your project, if hasDisplay = 1 then the device can use the Display block.

1 Like

Thanks @Nicolas for replying will try the code in my project.