Skip to content
Guides
Linking data to contacts

Linking data to contacts

Plunk can be considered as a lightweight CRM system. It allows you to link data to contacts. This is useful for storing information about your users and later using it in marketing automations and campaigns.

Linking data on event triggers

The best way to link data to contacts is to do it on event triggers. For example, when a user creates a new project, you can link the name of the project to the user. To do this, you add the data parameter to the event trigger. The data parameter is an object that contains key-value pairs of the data you want to store.

⚠️

It is important to note that the key of the data parameter is case-sensitive and unique. If you try to add a key that already exists in a contact, the previous data will be overwritten automatically.

await fetch('https://api.useplunk.com/v1', {
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer API_KEY", // Put your API key here
    },
    body: JSON.stringify({
        "event": "new-project",
        "email": "hello@useplunk.com",
        "data": {
            "project": "Plunk"
        }
    }),
});

Consuming data in templates

You can use the data you linked to contacts in your templates. For example, the project name you linked to the user in the previous example can be used in a template like this:

Hey there!
 
You created a new project called {{project}}.

Consuming data in transactional emails

Linked data can also be used in the subject and body of transactional emails.

await fetch('https://api.useplunk.com/v1/send', {
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        "Authorization": "Bearer SECRET_KEY", // Put your API key here
    },
    body: JSON.stringify({
        "to": "hello@useplunk.com",
        "subject": "Thanks for signing up!",
        "body": "<h1>Your new project is called {{project}}</h1>",
    }),
});