Adding a user to a list with mandrill - node.js

I'm trying to create a simple page on heroku to gather emails for an upcoming product launch. I'm trying to use the nodejs mandrill api wrapper to do accomplish this but it looks like there's no method for adding a user to a list. List subscription seems like it would be a really basic ESP function, am I missing something or is there some reason why this isn't included in the api.

Mandrill doesn't store your subscribers (unlike mailchimp), only your recipients blacklisted. You have to build your own storage layer.

Related

How to send a notification at a random time?

I would like to find out how, using Node.js, Express, Typeorm I can send notifications at random times to users to add a post etc.
I would like to create something of the BeReal sort. Notifications should be sent according to the user's selected time zone at random times.
If you want to send automated notifications, I'd recommend using
node-cron. However, for your case, I'd propose to add a timeZone
indicative information in the database to link the user with the
timeZone(you can find it in HTTP Requests, update it after each
login).
For the actual sending of the notifications, I think you should use
some third party service like Google Firebase for mobile
notifications, and web-push for web applications.

Best way to handle one-time payments with STRIPE webhooks in nodeJS

I am using STRIPE as my payment processor, in an REACT + nodeJS app. I already have something that already works, but I would like some feedback, maybe I'm doing something wrong.
So... I have this Redirect-To-Checkout functionality thats made available by STRIPE, basically I redirect the user to this STRIPE page where all card-data (sensitive information) is processes in order for the payment to full-fill.
What I do in my nodeJS server part is the following:
Once the user acces the redirect to check-out page, I already create a PendingOrder, with the products selected by client (Here I save some information based on client/stripe payment-intent, in order to check in later steps)
Once webhook gives me the 'payment_intent.succeeded' I check for the payment-intent information to see if it exists in my PendingOrder collection, then proceed to add in to ConfirmedOrders and remove it from PendingOrders.
I have to do this whole process because Stripe no longer gives me access to some information I require when the user is checking-out his order(such as observation that the user has based on the type of service he chooses).
Are there any down-sides to this approach or is there any other way to do it?
Thanks in advance!
You’re not really far from the best practices that Stripe recommends here. The only thing that I would change is listening to checkout.session.completed instead of the payment_intent.succeeded event. As of the latest API version, a PaymentIntent is no longer created upfront so a better to way to handle order fulfillment is to either store the Checkout Session ID (e.g. cs_live_xxx) or you could add some metadata when creating the Checkout Session and use that instead to identify the order.
I have to do this whole process because Stripe no longer gives me access to some information I require when the user is checking-out his order
As for this, I’m not sure what you mean, you can always use your app with the success page customization described here alongside webhooks. I wouldn’t use that to fulfill the order though since the user might close the page before the redirection completes which means that the fulfillment wouldn’t be done in that case. As such, webhooks are essential to order fulfillment.

Best way to efficiently send 1000 unique emails using the sendgrid/mail library for Node.JS

I have an admin panel in my Node.JS application where admins can login and send emails to groups of users. Sometimes these groups can contain up to 1,000 people. When the admin composes an email in the admin panel and hits the send button, I grab each row from the database and generate a unique link for that email body and then send it using the #sendgrid/mail npm package. I have looked at the following page and it is helpful: https://github.com/sendgrid/sendgrid-nodejs/blob/master/use-cases/README.md#email-use-cases
However, I don't know if it's more efficient to create a giant array of emails and dump that into one of the libraries methods, or if I should loop through and make a separate method call in each iteration and use Promise.all. I suppose I need a solution that won't make the Sendgrid rate limits angry but also not keep my http request loading for 30 seconds for the admin.
Thank you
From the UI you should get all the users that are to be emailed, into the node.js backend app.
In the backend app, assuming you get an array of the users, you use the Arrays.map() method to execute a function returns a promise that will send out the email.
You can then use Promise.all() to see what emails got send and what failed.
If there are any failures you can show that as a notification to the Admins on the UI, for only those users that failed.
Also note the SendGrid API seems to be capable of accepting 10k requests per second. Do take a look at this.

Retrieve a mailchimp list via GET

I am trying to retrieve a MailChimp list.
I have an API Key and a List ID, and while I understand that I can use the MailChimp API wrapper to achieve this I prefer to avoid implementing it since I only need to do this one task.
When I enter in my browser:
https://us3.api.mailchimp.com/2.0/lists/members?apikey=*****&id=******
I get a JSON result of my list - but it is limited to the first 25 subscribers. I don't see anything in the MailChimp API documentation about submitting a GET request to retrieve a list. Is it possible to do so? If so, how can I retrieve a full list?
Read this: http://apidocs.mailchimp.com/api/2.0/lists/members.php
Options are available via pagination.
You are supposed to POST the values in your request.
Looks like the best method is to use the MailChimp list method which "Exports/dumps members of a list and all of their associated details. This is a very similar to exporting via the web interface."
Read more at http://apidocs.mailchimp.com/export/1.0/list.func.php
Another option is to use API v1.3 listMembers function, more info here: http://apidocs.mailchimp.com/api/1.3/listmembers.func.php. v1.3 is deprecated, but it still functions properly.

Can I build an addin for Gmail?

Is there a way I can create an addin for my Gmail account? Is GreaseMonkey the only real way?
I use Gmail for customer service, and I'd like to create a tool that looks up the customer and preps a response to them based upon who it is in my database... instead of looking by hand for the client and typing it out.
You can add gadgets (same as iGoogle and wave) and add them to the side bar in GMail, but you will not have access to the e-mails themselves. You could create small lookup forms and such, though.
I don't see how else you could do it. You won't be able to run your own app on Google's backend, so that leaves the client (with javascript and something like GreaseMonkey) and your server (perhaps communicating with the client via AJAX).

Resources