brevo-node
brevo-node copied to clipboard
Is there a release date for Typescript support?
My current project used Typescript, I wasn't able to migrate from SIB to Brevo.
Hi @cody-ta We are still trying to find a way to provide TS support for the same. It is taking us some time to figure that out since our SDKs are auto-generated using swagger-codegen@2. Thanks.
Yeah, I think most of NodeJS developers will look for this issue. @shubhamUpadhyayInBlue have you tried https://github.com/acacode/swagger-typescript-api?
Also looking for typescript support as I'm moving my website from js to typescript at the moment.
Hello I have raised the request and will update you as soon as I have any updates. Thanks.
Until solved:
swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o ./lib/email/brevo
Until solved:
swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o ./lib/email/brevo
Better then lib 😄
@matthiasbruns How do you set the API key?
@matthiasbruns How do you set the API key?
new Brevo({
baseApiParams: {
headers: {
'api-key': yourKeyhere,
},
},
})
@NarHakobyan Thanks!
The latest swagger file is here: https://api.brevo.com/v3/swagger_definition_v3.yml
So, @matthiasbruns @NarHakobyan you can try using this latest swagger file instead.
Hi @shubhamUpadhyayInBlue, thanks for the new definition but there is an issue in the swagger file at line 17986. Please remove the double quote.
try to get swagger by URL "https://api.brevo.com/v3/swagger_definition_v3.yml"
☄️ start generating your typescript api
SyntaxError: ';' expected. (6656:97)
6654 | * @example "request"
6655 | */
> 6656 | event: "invalid_parameter" | "missing_parameter" | "hardBounce" | "softBounce" | "delivered"" | "spam" | "request" | "opened" | "click" | "invalid" | "deferred" | "blocked" | "unsubscribed" | "error" | "uniqueOpened" | "loadedByProxy" | "allEvents",
| ^
6657 | /**
6658 | * Webhook URL to receive CSV file link
6659 | * @example "https://brevo.com"
Hi @garysb I have fixed the swagger file. Please try and let me know if you face any issue.
Take me sometimes to get it working (because din't know how swagger-typescript-api was working) but now everything is working and tested!
https://gist.github.com/marentdev/28d49bfee47704ac39fcd55cb4ac8b0e (Brevo Lib)
Hi @shubhamUpadhyayInBlue Do you have defined an estimated time for an official documentation of the library under TS?
Developer:
If you do not know how to use the swagger-typescript-api library you can guide yourself with the following steps:
/** npx swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o [PATH-OUTPUT] -n [TS-FILENAME (Sample: Brevo.ts)]
**/
// SAMPLE
// console
npx swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o /src/utils/email -n Brevo.ts
...
// ts-file.ts
import { Brevo } from './utils/email/Brevo';
...
const brevo = new Brevo({ baseApiParams: { headers: { 'api-key': 'YOUR-KEY' } })
Hi @shubhamUpadhyayInBlue Do you have defined an estimated time for an official documentation of the library under TS?
Developer:
If you do not know how to use the
swagger-typescript-apilibrary you can guide yourself with the following steps:/** npx swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o [PATH-OUTPUT] -n [TS-FILENAME (Sample: Brevo.ts)] **/ // SAMPLE // console npx swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o /src/utils/email -n Brevo.ts ... // ts-file.ts import { Brevo } from './utils/email/Brevo'; ... const brevo = new Brevo({ baseApiParams: { headers: { 'api-key': 'YOUR-KEY' } })
Hi @higuitadiaz, Thanks for the explanation. Just a few comments, the swagger definition in your guide is outdated. The link to the current swagger definition is https://api.brevo.com/v3/swagger_definition_v3.yml (notice the second v3 at the end). Also swagger-typescript-api does not name the client "Brevo" by default. The name for the client is "Api", so you should either change the name to Brevo in the Brevo.ts file or use it like this:
// ts-file.ts
import { Api } from './utils/email/Brevo';
...
const brevo = new Api({ baseApiParams: { headers: { 'api-key': 'YOUR-KEY' } })
Really need ts support before we can migrate to brevo
I also need ts support before I can move to brevo... @shubhamUpadhyayInBlue have you thought about moving to the openapi generator? In openapi generator, which should be compatible to your swagger definition file, you should be able to generate typescript code for several libs like fetch or axios. https://openapi-generator.tech/docs/generators
Any update here @shubhamUpadhyayInBlue ?
We do not want to continue building with deprecated lib, but the lack of Typescript support here is blocking us. It has been several months since you've raised this issue, so I would hope some progress has been made. Could you provide us with an estimate?
Hi @cwierzbicki00 It is under discussion and we will be able to give feedback soon. I will make sure your message reaches the concerned team. Thanks.
Hi @shubhamUpadhyayInBlue Do you have defined an estimated time for an official documentation of the library under TS? Developer: If you do not know how to use the
swagger-typescript-apilibrary you can guide yourself with the following steps:/** npx swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o [PATH-OUTPUT] -n [TS-FILENAME (Sample: Brevo.ts)] **/ // SAMPLE // console npx swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o /src/utils/email -n Brevo.ts ... // ts-file.ts import { Brevo } from './utils/email/Brevo'; ... const brevo = new Brevo({ baseApiParams: { headers: { 'api-key': 'YOUR-KEY' } })Hi @higuitadiaz, Thanks for the explanation. Just a few comments, the swagger definition in your guide is outdated. The link to the current swagger definition is https://api.brevo.com/v3/swagger_definition_v3.yml (notice the second v3 at the end). Also swagger-typescript-api does not name the client "Brevo" by default. The name for the client is "Api", so you should either change the name to Brevo in the Brevo.ts file or use it like this:
// ts-file.ts import { Api } from './utils/email/Brevo'; ... const brevo = new Api({ baseApiParams: { headers: { 'api-key': 'YOUR-KEY' } })
Thanks for the Ts help. Can anyone help with the the steps to send a simple transactional email with a template and a param? I cant seem to follow the instructions with this ts file.
EDIT:
I figured it out. For anyone who gets confused too:
import { Api } from './utils/email/Brevo' // import from whichever location you generated the ts file to
const brevo = new Api({ baseApiParams: { headers: { 'api-key': 'YOUR-KEY' } })
let emailData: SendSmtpEmail = {
templateId: parseInt(templateId),
sender: { name: siteConfig.name, email: env.SMTP_FROM },
to: [{ email: identifier }],
headers: { "X-Entity-Ref-ID": new Date().getTime() + "" },
params: {
action_url: url,
product_name: siteConfig.name,
},
};
const result = await await brevo.smtp.sendTransacEmail(emailData);
if (result.status != 201) {
throw new Error(result.error.message);
}
Thanks
Is there any update about the typescript release ?
$ npm remove @sendinblue/client
$ npm install @getbrevo/brevo
$ npm i --save-dev @types/getbrevo__brevo
npm ERR! code E404
=> Googling, finding this github issue, then 5 minutes later:
$ npm remove @getbrevo/brevo
$ npm install @sendinblue/client
:)
(I do hope they support TS soon though as the security audit of sendinblue/client is bad)
Sending transactional emails via axios/fetch is more comfortable
Until solved:
swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o ./lib/email/brevo
how do I make use of this
Is there any update about the typescript release ?
I am not sure because I have not seen one
Is there any news about TypeScript?
Up !
Is there something new on this? Send In blue is gone now for a while and still missleading docs on the page, still no TS support.
Hi, my client bought a license for Brevo without telling me, now i'm stuck with this and can't deliver the app, client is waiting, do you guys could at least bother to respond to us ? I understood you guys don't care but we are client, and you can bet I won't recommend this to any of my clients in the futur
@shubhamUpadhyayInBlue
Hi @cwierzbicki00 It is under discussion and we will be able to give feedback soon. I will make sure your message reaches the concerned team. Thanks.
This seems to be a larger and larger issue for everyone. Especially knowing that the types can be generated, this is frustrating. "swagger-typescript-api -p https://api.brevo.com/v3/swagger_definition.yml -o ./lib/email/brevo" is not a valid long-term solution for a production level product like this. I am hoping for an update soon.
Please at least advise how we should proceed - we need Typescript support. I don't want to build with insecure and deprecated sendinblue. What are we to do to use Brevo?
Thanks