dan
dan

Reputation: 1050

Custom Identifier SendGrid Inbound Parse API

So, I'm using SendGrid to send marketing campaigns from my own SaaS platform. I recently discovered that SendGrid provide an Inbound Parse feature, so I can catch the emails that people reply to those campaigns. My idea then was adding to my platform 2 way email (sending and receiving within it)

I already setup everything and I'm parsing the emails using requestb.in. My question/problem is how can I identify who replied to the email without using the "from" header (the email account that replied) ?

For example, I send an email campaign to 100 customers. 20 of them reply to those emails. Is there a way to use a custom header or something so I can set a unique identifier and catch it when parsing the reply? In my case, my SaaS platform creates one database per signup customer. So the ideal solution would be having the database identifier within the email header when parsing it.

I have done this for the Notifications SendGrid feature, using when sending the email campaign:

->addUniqueArgument('user_database_id', IDENTIFIER)

Is there a way I can catch this information within the reply, using the Parse SendGrid API?

Thank you in advance!

Solution I used:

I decided that adding a hidden input with the identifier I needed was the best solution. Having that information within the subject or within the reply-to was too visible for the end user.

Upvotes: 5

Views: 1371

Answers (2)

Phani
Phani

Reputation: 861

When you send out an email to the customer, add your customer information/identifier to the email headers. 'References' is a standard header you will see for emails, and it usually holds the reference Ids of all the emails in the email chain, this is how most email clients group/identify mutliple emails belonging to the same conversation(forwards/replies included).

So you could do something like(in C#)

outBoundEmail.Headers.Add("References", "your-customer-identifier");

now when customers reply to this email directly, or they forward it to someone else within their organization and that other person replies. You will see something like this in the header when you receive the reply.

References: your-customer-identifier
            email-identifier-forwarded-email
            email-identifier-original-email-you-sent

I had a similar problem to solve in which I used this approach and it is working like a charm.

Upvotes: 0

bwest
bwest

Reputation: 9844

You'll have to embed the unique identifier somewhere in the content itself. You'll want to put it somewhere that it's unlikely to be altered by the user. I think the easiest way is to put the unique identifier in the reply-to address itself, e.g. [email protected]. You can also use the subject line for this.

Upvotes: 7

Related Questions