How does SendGrid notify (delivered-open-click) events when multiple email recipients are specified - email

When you send an email through sendgrid, and the recipient opens the email, SendGrid will notify my server about that using webhooks (open) event.
https://docs.sendgrid.com/for-developers/tracking-events/event
But what happens if I specify multiple recipients for the same email with personalizations, do I get the same (open) event every time one of the recipients opens that email? If so how can my server figure which recipient?
What about the (delivered) event? Same questions.

Twilio SendGrid developer evangelist here.
The best way I found to achieve this is to send custom_args with the email, you can add custom_args to each individual personalisation object. Parameters set in custom_args are also sent along in the event webhook.
I wrote a post about how to use custom_args to track email statuses. The post uses Ruby on Rails as the framework, but covers using custom_args and reading them back in the event webhook to update the email in your own database.

Related

How to track status of email in sendgrid without using SMTP.

I want to send emails which contain different contents to same user and I need to track their status. Are there any way to do that without using SMTP.
Sounds like you want Unique Args. These are called custom_args in the v3 API mail send argument, but it's the same concept.
Once you activate the Event Webhook, all events will include the appropriate unique_args, so you can relate each specific message to each.
Also, whenever you send a message to SendGrid, the acceptange response includes a message_id, which will be in all those events.

Identify email message related to received webhook

Today I started to learn about webhooks and I was wondering if it is possible to know exactly what message is related to a received webhook.
For example, I have a website where customers can register and, after a successful registration, I'm sending them a confirmation via email. Is it possible to know that the customer clicked on that specific email message? (Considering that the customer can receive other types of email messages like password recovery, newsletters, etc). I know I can use the subject (something like if subject == 'Welcome to My Site' then do-email-post-registration-clicked-routine) but if the subject changes, or if they change it (when we reply to a message, usually the email client prepends "Re:" to the subject, I won't be able to track it.
Thanks in advance!
Yes. You can use custom arguments to track individual emails. Custom arguments get sent with event webhooks.
More documentation can be found here: https://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html

How can I setup an inbound action on an email incoming

I am developing an application, where I have a use case where I advertise a particular email id on a web site. Now, I need people to send me some information and an attachment to that email id . When I receive that email, it should trigger some action in my web application, such that I have both this document and the body of the email available to be in my web application. Then I can parse this information and take appropriate action. Let me know if it is possible to do this kind of email processing using Mandrill or Mailgun or SendGrid, and if yes, can you provide details/documention links on how this can be done.
Thanks
kabir
All three of those services support "inbound" email parsing, which should allow you to process and react to received emails.
Essentially they'll receive and process the email on your behalf, and send you a webhook with normalized data. Docs links below.
SendGrid Inbound Parse Webhooks
Mailgun Inbound Routes API
Mandrill Inbound Email Parsing

sendgrid email via X-SMTP

I am trying to figure out how can I make it possible to send an email from my
application to Sendgrid and have it come back.
I want to use coldfusion to send an email using X-SMTP API. I found a documentation
online here but still wondering if there's any documentation available other
than the web API one?
http://thehatrack.net/blog/integrating-sendgrid-with-your-coldfusion-application/
SendGrid's Event Webhook is the only way to get email reads on an individual basis. This will POST an event to your server every time an email is read (among several other events).
The only "pull" based solution to get individual email events from SendGrid is the bounces endpoint, which will tell you when an email bounces (and is certainly not read), but nothing else.
If you want to retrieve individual read events from SendGrid, you'll need to connect the Event Webhook to an external service like Keen.io, and then leveraging their API to get individual events.

How do I build a notification email/reply system like Facebook?

When users receive a notification email about a new private message on Facebook, they can reply to the email and have their response automatically added to the conversation on the site.
How can I build a cross platform system like that? I'm building a group chat system.
This is obviously way over-simplified, but here we go:
The way Facebook's emails work is by using a string that's unique to the receiver in the reply-to address:
<m+50edqb50000003jtdj389k6xib6hofj6t41q1c45sdt92qc#reply.facebook.com>
So when Facebook receive an email into reply.facebook.com, they (presumably) parse the string after the plus sign, decide which user/conversation it's relevant to, and add the text of the email into that conversation.
One option:
Send every notification email with a unique reply-to address, then receive replies with a customized SMTP server that will pair responses with the originating message object in your DB.
Since you are using django (according to your tags) I would recommend looking at the Lamson python SMTP server. It can be programmed to correctly attribute each message. Using Lamson with Django is documented.