Code Monkey home page Code Monkey logo

Comments (5)

nikhilym avatar nikhilym commented on July 22, 2024 1

Glad to know that you got it working. What I meant by calling external APIs is, that the SDK doesn't provide any helper functions or any configurations through which skill developers can do a simple function call to external APIs.

For Alexa specific APIs, as you can check in your ISP code, you can just do a handler_input.service_client_factory.get_monetization_service().<call_some_method>. However, you cannot use the service client factory to call any external API. Hope this helps.

Since you are able to get this working, I am going ahead and closing this issue. Please let us know if you face any other problems. Thanks.

from alexa-skills-kit-sdk-for-python.

nikhilym avatar nikhilym commented on July 22, 2024

Hey @danieldhz , StandardSkillBuilder and CustomSkillBuilder are different types of skill builder, which eventually will give you a skill for dispatching the input requests. You will need only one type of skill builder for a specific skill.

For your context, you can directly use StandardSkillBuilder without any api client initalization. The SDK will handle that for you. Hope this helps.

from alexa-skills-kit-sdk-for-python.

Daniyaldehleh avatar Daniyaldehleh commented on July 22, 2024

Hi @nikhilym !
Thanks for your response. So I do not need sb = CustomSkillBuilder(api_client=DefaultApiClient()) to call an external api in my function?
cause without it I am now getting:

START RequestId: aec1f79f-bb1b-4883-b7c2-829016f049ba Version: $LATEST
[INFO]	2020-09-01T19:40:01.46Z	aec1f79f-bb1b-4883-b7c2-829016f049ba	Starting Entitled Product Check
[INFO]	2020-09-01T19:40:01.84Z	aec1f79f-bb1b-4883-b7c2-829016f049ba	new session, so see what is entitled
[INFO]	2020-09-01T19:40:01.311Z	aec1f79f-bb1b-4883-b7c2-829016f049ba	Error calling InSkillProducts API: The authentication token is invalid or doesn&#39;t have access to make this request
[ERROR]	2020-09-01T19:40:01.324Z	aec1f79f-bb1b-4883-b7c2-829016f049ba	The authentication token is invalid or doesn&#39;t have access to make this request
Traceback (most recent call last):
  File "/opt/python/lib/python3.8/site-packages/ask_sdk_runtime/dispatch.py", line 116, in dispatch
    request_interceptor.process(handler_input=handler_input)
  File "/var/task/lambda_function.py", line 188, in process
    result = ms.get_in_skill_products(locale)
  File "/opt/python/lib/python3.8/site-packages/ask_sdk_model/services/monetization/monetization_service_client.py", line 129, in get_in_skill_products
    api_response = self.invoke(
  File "/opt/python/lib/python3.8/site-packages/ask_sdk_model/services/base_service_client.py", line 151, in invoke
    raise ServiceException(message=exception_metadata.message,
ask_sdk_model.services.service_exception.ServiceException: The authentication token is invalid or doesn&#39;t have access to make this requestEND RequestId:

not sure if its related

from alexa-skills-kit-sdk-for-python.

nikhilym avatar nikhilym commented on July 22, 2024

For calling alexa services, you would need the api_client to be initialized. If you are using CustomSkillBuilder, you can initialize it manually. If you are using StandardSkillBuilder, it is initialized by default. We currently do not support calling external APIs (other than Alexa custom skill service APIs) from the SDK.

Now, from the error message that you pasted, it looks like the service call happened but it failed at the auth level. Since the call itself happened, your api client is initialized just fine and has nothing to do with this issue.

from alexa-skills-kit-sdk-for-python.

Daniyaldehleh avatar Daniyaldehleh commented on July 22, 2024

Thank you so much for your comprehensive explanation. I fixed the error. I am just not sure what you meant on not supporting external APIs? Alexa can't call external APIs? Cause I was just able to build a func today where Alexa made POST request on user's google calender and it was successful in the development stage.

from alexa-skills-kit-sdk-for-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.