What's the best way to handle email address changes?

The best way to update Plunk with a user's new email address is to either update the contact using the PUT endpoint, delete the contact and create a new one, or unsubscribe the contact and create a new one. These options will ensure that future emails are sent to the correct email address.

This solution was generated by AI, if you think it's wrong, please report it.

krisniles avatar

krisniles

A year ago

If an existing user changes their email address, what's the best way to update Plunk with the new email address? Thanks!


driaug avatar

driaug

A year ago

Open-Source ContributorTeamUpdates

I always suggest making a new contact but if you really want to change a contact's email then you can do that! When you create a contact/trigger an event you always get the contactID as a response, I suggest you store it in your database if you expect to query Plunk frequently.


driaug avatar

driaug

A year ago

Open-Source ContributorTeamUpdates

There is a PUT endpoint at /v1/contacts that takes in the following body

{
  "id": "contact-id",
  "email": "hello@useplunk.com"
  "subscribed": true,
  "data": { "key": "value" }
}

driaug avatar

driaug

A year ago

Open-Source ContributorTeamUpdates

It's important to keep in mind that this is a destructive endpoint, as in it will always overwrite email, subscribed and data with the provided values


krisniles avatar

krisniles

A year ago

Ah ok - I assumed that if I just created a new contact, then I would still be sending emails to the old contact as well (i.e. future newsletters, etc). I wouldn't want to send to the previous email any longer. Would that be the case, or am I missing something?


driaug avatar

driaug

A year ago

Open-Source ContributorTeamUpdates

That is indeed correct, if you also want to prevent the previous email from being used you need to use one of these options

  • Update the contact using the PUT endpoint
  • Delete the contact and create a new one (DELETE /v1/contact with id in body)
  • Unsubscribe the contact and create a new one (POST /v1/contact/unsubscribe with id in body), if a contact is in an unsubscribed state then you can't send campaigns or marketing templates to them anymore. Transactional templates and emails will however still come through

krisniles avatar

krisniles

A year ago

Got it, thank you! I can work out one of those options when I get there. Just wanted to make sure I wasn't missing anything.