zygos / mailerlite-api-v2-node Goto Github PK
View Code? Open in Web Editor NEWNode.js wrapper for MailerLite API v2 with Promises, Typescript and camelCase by default.
License: MIT License
Node.js wrapper for MailerLite API v2 with Promises, Typescript and camelCase by default.
License: MIT License
I see loads of code with return await
like in this example from account.ts
:
return {
async getAccountRaw(): Promise<AccountWrap> {
return await client.get('me')
},
async getAccount() {
const { account } = await this.getAccountRaw()
return account
},
async getMe() {
return await this.getAccount()
},
}
since client
is already a Promise you could do just:
return {
getAccountRaw(): Promise<AccountWrap> {
return client.get('me')
},
...
}
Hello,
I am testing this repo. It works fine.
However now I am using it in development mode, in a specific React component.
I understand this is not secure, because the API key will be exposed publicly.
Can you please suggest how to implement a server side management of the authentication process?
Thank you
Hey there!
I have been working with the mailer lite API integration. while using this npm package to get a list of groups. I am getting a group id while fetching data form that group using that group Id i am getting a 404 error as a response. While doing the same in postman i am getting a different group id where i am able to get desired response. why the id of the group differs while using the fetch method and in postman. Can you please help me to resolve this issue.
Thank You in Advance
429
using setTimeout
based on the X-RateLimit-Retry-After
response headerhttps://developers.mailerlite.com/docs/api-rate-limits
Thanks
If you want to edit a subscriber’s email address, you will have to add them as a new subscriber or have them sign-up through one of your forms using the new email address.
- How to edit a subscriber's data - MailerLite
Would it be possible to add a method that automates this process, including getting the existing subscriber's data and including it into the new one ?
Thanks
Hey! Thanks for making this api. I had given up last year after having been unable to find anything useable in my React application. I have kind of a weird issue, I installed the api and used it once with success. I was able to add my email to my group and verified it inside my MailerLite account. When I went to make a component that did that (it was originally just raw html inside another component), I got an error code saying access was denied. Specifically, it says:
"Access to XMLHttpRequest at 'https://api.mailerlite.com/api/v2/groups/104625980/subscribers' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field x-mailerlite-apikey is not allowed by Access-Control-Allow-Headers in preflight response."
Here is my MailerLite.js file:
const MailerLite = require('mailerlite-api-v2-node').default;
var apikey = example_api_key;
const mailerlite = MailerLite(apikey);
export default mailerlite;
Here is the function I am using to post my new subscriber:
addEmailSub = () => {
var email = document.getElementById("email").value;
mailerlite.addSubscriberToGroup(104625980, email);
}
Any input would be appreciated!
Hey
I'm sorry I don't know if this is the right place for this... I'm slightly at my wits end trying to figure out what's wrong here. It should work I think. I've tried using your package and it just won't accept my post to add a new subscriber.
I posted about this on stack overflow, here's the link: https://stackoverflow.com/questions/65355078/axios-post-in-react-front-end-leading-to-error-when-posting-to-mailerlite
Do you have any suggestions for what is going wrong here?
Hi,
currently you have such an interface: (before)
export interface SubsriberFields {
city: string
company: string
[key: string]: any
}
I think this interface should look like this: (after)
export interface SubsriberFields {
[key: string]: string | number | Date
}
since only these types are allowed and field can be any string.
I am trying to build express.js app and got this error.
node_modules/mailerlite-api-v2-node/dist/index.d.ts:48:66 - error TS2694: Namespace '"/Users/henprokuror/VS_Code/Datrics/backend/node_modules/mailerlite-api-v2-node/dist/@types/index"' has no exported member 'CampaignAction'.
48 actOnCampaign(campaignId: number, action: import("./@types").CampaignAction, data?: import("./@types").CampaignSendData): Promise<import("axios").AxiosResponse>;
Hi!
Right now if we want to use the input types directly, we have to import them from dist
like import { GroupSubscriberData } from 'mailerlite-api-v2-node/dist/@types';
.
It would be nice if we could import them directly from the root.
Happy to push a PR I just wanted your input before doing so.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.