aws-amplify/aws-sdk-ios

How to call Amazon Lex v2 bot

tingyao-chang opened this issue · 4 comments

State your question
Need to use Amazon Lex v2 for production, but now the iOS SDK does not have Lex v2, it seems that I need to call the Lex v2 API, are there any guides or examples that can let me sign API requests using the iOS SDK?

Which AWS Services are you utilizing?
Amazon Lex v2

Provide code snippets (if applicable)

Environment(please complete the following information):

  • SDK Version: [e.g. 2.6.29]
  • Dependency Manager: [e.g. Cocoapods, Carthage]
  • Swift Version : [e.g. 4.0]

Device Information (please complete the following information):

  • Device: [e.g. iPhone6, Simulator]
  • iOS Version: [e.g. iOS 11.4]
  • Specific to simulators:

If you need help with understanding how to implement something in particular then we suggest that you first look into our developer guide. You can also simplify your process of creating an application, as well as the associated backend setup by using the Amplify CLI.

Thank you for the feature request - our team will discuss it internally and post further updates on this ticket.

Hi @thisisabhash, thanks for your reply. Since the application go-live timeline is tight, is there any documentation I can refer to regarding signing Amazon Lex v2 API requests, for example using AWSCore/Authentication/AWSSignature? I would appreciate any pointers. Thanks!

Hi @tingyao-chang, I know of a AWSSignatureV4Signer usage from here (Amplify V1).

/// ... 
endpoint = AWSEndpoint(region: region,
                                   serviceName: URLRequestConstants.appSyncServiceName,
                                   url: mutableRequest.url)
let signer: AWSSignatureV4Signer = AWSSignatureV4Signer(
            credentialsProvider: iamCredentialsProvider.getCredentialsProvider(),
            endpoint: endpoint)
  • AWSEndpoint's service name most likely can be hardcoded like the example above, unless you can use AWSServiceType.LexRuntime. The reason why I think you might need to hardcode it is because AWS SDK iOS's service name for Lex is from the support for Lex V1. If it's the same as Lex V2 then you should be able to use it.
  • I'm guessing the endpoint URL should be from here https://docs.aws.amazon.com/general/latest/gr/lex.html let us know if it works!
  • For the credentials provider, I believe If you are using AWSMobileClient from AWS SDK iOS, the default() instance is the credentials provider you can use to pass in. (SDK docs)