question

newuser-346be5a6-fc6f-4825-88d3-abde833e3227 avatar image
newuser-346be5a6-fc6f-4825-88d3-abde833e3227 asked ·

In Python, how to get the slot value

I have Alexa hosted Python. The JSON input below shows that there is a request.intent.slots.org.value, it should return "Linkedin".

When I use "speak_output = handler_input.request_envelope.request.intent.slots.org.value", it keeps erroring out. For the life of me, I can't figure out why I can't get the value.

    "request": {
        "type": "IntentRequest",
        "requestId": "xx",
        "locale": "en-US",
        "timestamp": "2021-03-04T18:31:07Z",
        "intent": {
            "name": "TellMeStatusIntent",
            "confirmationStatus": "NONE",
            "slots": {
                "org": {
                    "name": "org",
                    "value": "LinkedIn",
                    "resolutions": {
                        "resolutionsPerAuthority": [
                            {
                                "authority": "xxx,
                                "status": {
                                    "code": "ER_SUCCESS_MATCH"
                                },
                                "values": [
                                    {
                                        "value": {
                                            "name": "linkedin",
                                            "id": "xxx"
                                        }
                                    }
                                ]
                            }
                        ]
                    },



python
10 |2000 characters needed characters left characters exceeded

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

1 Answer

Gaetano@Amazon avatar image
Gaetano@Amazon answered ·

Hello and thanks for posting.

The Python SDK has a function that lets you retrieve the slot value, you can find additional info here.

Regards,
Gaetano

2 comments
10 |2000 characters needed characters left characters exceeded

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

i tryed this and dont solve my problem

have another idea?

0 Likes 0 ·
Andy Whitworth avatar image Andy Whitworth Giovanni scheer ·

post up your python code lines where you're attempting to access the slot data + the line where you import any helper functions from the sdk.

0 Likes 0 ·