Vonage / vonage-node-sdk

Vonage API client for Node.js. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
Apache License 2.0
380 stars 181 forks source link

How Do I: get a private_key in the Create Application v2 API in nodejs SDK? #955

Open s-lukashenka-micoworks opened 2 weeks ago

s-lukashenka-micoworks commented 2 weeks ago

How do I

If I am getting it right, a call to Create Account v2 API is supposed to return a private key alongside the public one, but in nodejs SDK it returns only the public one. Please, make it return the private key as well as that is important for application creation automation.

API/Product

Applications

Code Sample

API documentation pointing to its existence in the API response: https://developer.vonage.com/en/api/application.v2#createApplication-responses

manchuck commented 2 weeks ago

@s-lukashenka-micoworks The keys should be in the response after you call createApplication. The only thing the SDK is doing, is adding the camelCasing properties to the response. This means that you should have the private key under the keys response:

const newApplication = await vonage.applications.createApplication({
  name: 'my-awesome-app',
})

console.log(newApplication.keys.privateKey)
console.log(newApplication.keys.private_key);

LMK if you need any more assistance with this

s-lukashenka-micoworks commented 2 weeks ago

@manchuck I understand that the actual API returns that parameter, but the types in SDK do not have it: https://github.com/Vonage/vonage-node-sdk/blob/3.x/packages/applications/lib/types/Application.ts#L29. Could it be added, please? I can make a PR for that if needed.

s-lukashenka-micoworks commented 1 week ago

@manchuck I have tried making a PR for the changes needed: https://github.com/Vonage/vonage-node-sdk/pull/956

manchuck commented 1 week ago

Ahh, I can see the issue if you're using TypeScript.