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.
Related
I'm using a certain SendGrid template for several different projects and am trying to find a way to stop emails from going out in some conditions, through SendGrid.
For example, lets say I'm passing SendGrid some parameters like:
{id, name, amount, date}
I want to stop that email from going out when i'm passing a certain id.
I know that I can change the email template i'm sending with conditionals using handlebars:
From here
But Can I actually stop the mail if some condition happens?
In my case, every time I send the id = 5
You can control the body of the email using Handlebar templating, but by that point, you have already told SendGrid to send email with the data you provided. You cannot stop the email from being sent from within Handlebars.
If you're using code to tell SendGrid to send these emails, you could check in your code if the id equals 5, and if so, do not send an email.
If you're using Single Sends to send an email to SendGrid Contacts, you could to store this id field as a custom field, and create a segment or update your existing segment to filter out the contact with that id.
I am sending emails from sendgrid from my backend. When I send the email, the response is 202 and the response body is empty. Since the response body is empty, i do not have any information like an ID to track the email events in my system.
When I go to fetch the events, i see they have an ID, but since I don't have that ID from their creation, I cant map emails I sent to events I received.
Can you give an email an ID or label it somehow when you send it? So that you can map al the events from it?
What we are trying to do is to have a list of "transactions" where each "Transaction" is affiliated with an email. We want to provide email event data in our app, but can't figure out how to map
The response body of a successful Mail Send API call is empty, but the response contains a x-message-id header which you can use to retrieve details about the messages being sent.
Since one API call to the Mail Send API can result in multiple emails being sent, this ID identifies the group of messages, and they'll all be prefixed with the x-message-id. For example, if x-message-id returns W86EgYT6SQKk0lRflfLRsA, the IDs of your messages will start with that and then be suffixed with something like .filterdrecv-5645d9c87f-78xgx-1-62841247-82.1.
Together it'd look like W86EgYT6SQKk0lRflfLRsA.filterdrecv-5645d9c87f-78xgx-1-62841247-82.1.
If you want to track the messages, you can use the event webhook or pull the information via the Email Activity Feed API.
This Stack Overflow Q&A about tracking bulk email statuses may also be useful to look at.
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.
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
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.