Double opt-in is a great way to ensure that your contacts are interested in receiving your emails.

When you set up double opt-in, your contacts will receive an email asking them to confirm their subscription. Only after they confirm will they be added to the subscribed list.

Creating an unsubscribed contact

We will start by creating a contact that is unsubscribed. You can do this by triggering an event and setting the subscribed property to false.

await fetch('https://api.useplunk.com/v1/track', {
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer <API_KEY>"
    },
    body: JSON.stringify({
        "event": "subscribed",
        "email": "hello@useplunk.com",
        "subscribed": false
    })
});

Setting up a double opt-in template & action

Next, we will create a template and action that will be used to send the double opt-in email.

For the template there are two possible options:

  • Use Plunk’s subscription page, which is available for each contact at
  • Build your own subscription page and use the contacts API to subscribe the contact.

After you have made your decision, create a transactional template and an action that triggers when the subscribed event is triggered.

It is important to use a transactional template and not a marketing template. Marketing templates will not be sent to unsubscribed contacts.

Triggering the double opt-in email

Now that everything is set up, you can integrate a trigger for your event into your landing page, blog, or wherever you collect emails.

Contacts will remain in an unsubscribed state until they click the link in the double opt-in email and confirm their subscription on the subscription page.