Skip to content

Create your own survey links

This guide collects the different ways to generate an nps.today survey link yourself, so you can send or embed it from your own system (an ESP such as Agillic, a CRM, or a newsletter tool) instead of letting nps.today send the email. In every case the survey is still created and reported in nps.today, only the delivery happens in your system.

To keep responses tied to a person (not anonymous), you generate a personalized link that carries the respondent's data.

Which method should I use?

Method API key Hashing / secret Campaign member created Best for
1. Personalized link via script No Yes On reply Bulk sends from your own email/ESP, generated upstream in a script or middleware
2. API (GenerateLink) Yes No At generation Systems that can call the API and prefer not to hash

The "Campaign member created" column matters for volume: On reply means nothing is recorded in nps.today until the respondent actually answers, while At generation creates the member up front.

Prerequisites

Keep responses identifiable

Include at least one identifying field in the link (typically email and/or ext, your own contact id). Without any respondent data the response cannot be linked back to a person.

A personalized link is a campaign‑specific, single‑use link that you build and sign yourself, with no API call. It carries the respondent's details and a signature (sha) so nps.today can trust it.

Campaign member creation

The campaign member is created only when the respondent answers. No campaign member or response is recorded in nps.today until then, which makes this a good fit for large sends where you expect a low response rate.

The link format is:

https://r.nps.today?cid=19090&firstName=John&lastName=Doe&[email protected]&phone=4512345678&ext=CRM-42&id=<GUID>&employee=&sha=7fab5a3b9d39321213ee6d7dc7a30990a820f2a3239623d078f2a42dd6051976

cid: your campaignID.
id: a unique GUID you generate for each recipient. This is what makes every link unique and single‑use.
firstName, lastName, email, phone, ext, employee: optional fields. Include at least one identifying field for non‑anonymous responses. Omit any field you don't use.
sha: the signature (see below).

You can also append your own custom fields after sha. What each field means, and which field names are reserved, is described in Unique personalized links.

Calculating the sha

The sha is a SHA‑256 hash that proves the link was generated by you. You create one per recipient. In practice:

  1. Collect the field values for the recipient, for the fields you intend to include.
  2. Build the content string: concatenate the values into a single string, in this exact order, with no separators, and your secret added at the very end:
    cid + firstName + lastName + email + phone + ext + id + employee + secret
    
    If you don't use a field, leave it out of both the string and the URL, and keep the remaining fields in the same order.
  3. Hash it with SHA‑256 and take the lowercase hex output. That string is your sha.
  4. Assemble the URL from the raw field values plus &sha=, then URL‑encode the finished URL. The sha is hex, so encoding doesn't change it.

Only these fields are hashed

Only the fields listed above go into the hash. Custom fields, rating, and the sha itself are never part of the hashed string. It is a plain hash, not an HMAC. The secret is simply the last thing concatenated before hashing.

Worked example

With the following values (and a fixed id so it's reproducible):

Field Value
cid 19090
firstName John
lastName Doe
email [email protected]
phone 4512345678
ext 42
id b77063db-181c-4084-957f-590c04de255c
employee [email protected]
secret MY-EXAMPLE-SECRET (example only, use your own)

the content string is:

19090JohnDoejohn@example.com451234567842b77063db-181c-4084-957f-590c04de255cemployee@company.comMY-EXAMPLE-SECRET

Notice the string has no field value like ?cid= or &firstName= prefixes and no separators. Those are added only when you build the URL.

and its SHA‑256 hex is:

ea6a596ddf42e8cb66b904745bd6d42290f4d31c182682bf802cd6a8e5dee513

The hash depends on the exact values, the id, and your secret, so every recipient's link has a different sha.

Where to generate it in practice

Most email systems can't compute a SHA‑256 inside a template, so don't try to hash in the email editor. Generate the finished link upstream in a small script, your CRM, or middleware (for example a Power Automate flow or a function) using one of the snippets below and then pass the complete URL into your email as a personalization / merge field.

Code examples

The examples below build the content string, hash it and assemble the URL. They use the same field order as described above.

import hashlib
import uuid
from requests.utils import quote

baseUrl = 'https://r.nps.today'

#fields
cid = '9142'
firstName = 'John'
lastName = 'Doe'
email = '[email protected]'
phone = '4512345678'
ext = '42'
id = str(uuid.uuid4())
employee = '[email protected]'

#custom fields
car = 'toyota'
year = '2009'

#hash fields + secret using SHA 256 algorithm.
secret = 'YOUR_SECRET'
content = cid + firstName + lastName + email + phone + ext + id + employee + secret
sha = str(hashlib.sha256(content.encode('utf-8')).hexdigest())

url = baseUrl + quote(
    "?cid="+cid+
    "&firstName="+firstName+
    "&lastName="+lastName+
    "&email="+email+
    "&phone="+phone+
    "&ext="+ext+
    "&id="+id+
    "&employee="+employee+
    "&sha="+sha+
    "&car="+car+
    "&year="+year, safe='~@#$&()*!+=:;,.?/\'')

print("content: " + content)
print("guid: " + id)
print("sha: " + sha)
print("URL: " + url)
const uuidv4 = () => {
    return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g,
        c =>
        (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
    );
}

const digestMessage = async (message) => {
    const msgUint8 = new TextEncoder().encode(message);                           // encode as (utf-8) Uint8Array
    const hashBuffer = await crypto.subtle.digest("SHA-256", msgUint8);           // hash the message
    const hashArray = Array.from(new Uint8Array(hashBuffer));                     // convert buffer to byte array
    const hashHex = hashArray.map(b => b.toString(16).padStart(2, "0")).join(""); // convert bytes to hex string
    return hashHex;
}

(async () => {

const baseUrl = "https://r.nps.today"

//fields
const cid = "9142";
const firstName = "John";
const lastName = "Doe";
const email = "[email protected]";
const phone = "4512345678";
const ext = "42"
const id = uuidv4();
const employee = '[email protected]'

//custom fields
const car = "toyota";
const year = "2009";

//hash fields + secret using SHA 256 algorithm.
const secret = "YOUR_SECRET"
const content = cid + firstName + lastName + email + phone + ext + id + employee + secret;
const sha = await digestMessage(content);

const url = encodeURI(baseUrl +
              "?cid=" + cid +
              "&firstName=" + firstName +
              "&lastName=" + lastName +
              "&email=" + email +
              "&phone=" + phone +
              "&ext=" + ext +
              "&id=" + id +
              "&employee=" + employee +
              "&sha=" + sha +
              "&car=" + car +
              "&year=" + year);
console.log("content: " + content);
console.log("guid: " + id);
console.log("sha: " + sha);
console.log("URL: " + url);
})();
using System;
using System.Text;
using System.Security.Cryptography;
using System.Web;

public class Program
{
  public static void Main()
  {
    string baseUrl = "https://r.nps.today";

    //fields
    string cid = "9142";
    string firstName = "John";
    string lastName = "Doe";
    string email = "[email protected]";
    string phone = "4512345678";
    string ext = "42";
    string id = Guid.NewGuid().ToString();
    string employee = "[email protected]";

    //custom fields
    string car = "toyota";
    string year = "2009";

    //hash fields + secret using SHA 256 algorithm.
    string secret = "YOUR_SECRET";
    string content = cid + firstName + lastName + email + phone + ext + id + employee + secret;
    string sha = ComputeSha256Hash(content);

    string url = System.Uri.EscapeUriString(baseUrl + "?cid=" + cid + "&firstName=" + firstName + "&lastName=" + lastName + "&email=" + email + "&phone=" + phone + "&ext=" + ext + "&id=" + id + "&employee=" + employee + "&sha=" + sha + "&car=" + car + "&year=" + year);
    Console.WriteLine("content: " + content);
    Console.WriteLine("guid: " + id);
    Console.WriteLine("sha: " + sha);
    Console.WriteLine("url: " + url);
  }

  static string ComputeSha256Hash(string rawData)
  {
    using var sha256Hash = SHA256.Create();
    byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(rawData));
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < bytes.Length; i++)
    {
      builder.Append(bytes[i].ToString("x2"));
    }

    return builder.ToString();
  }
}

If you'd rather not compute a hash or hold the secret in your own system, you can let nps.today mint the link for you. Call the Generate link endpoint per respondent, map the respondent's data in the request, and embed the link it returns:

Campaign member creation

A campaign member is generated as soon as you call GenerateLink. While this increases overall survey volume (since it occurs before submission), it enables you to track and calculate response rates. The returned id references this pre-existing campaign member in nps.today.

See the endpoint in the API reference. The returned link can be used in its short form, where id refers to the campaign member the API already created and mapped, so no cid or sha is needed.

The request body is an array of campaign member objects, the same as for POST /campaigns/{campaignId}/respondents, and the response is a list of strings, one per respondent. Here is an example of the body:

[
    {
        "respondent": {
            "emailAddress": "[email protected]",
            "firstName": "John",
            "lastName": "Doe",
            "company": {
                "name": "nps.today"
            }
        },
        "employee": {
            "email": "[email protected]",
            "firstName": "Janne",
            "lastName": "Hansen"
        },
        "custom": {
            "ticketid": "1209381dsf1"
        }
    }
]

The returned id (GUID) is used together with the base URL;

81ad980e-a6ca-4ae4-a38e-d627d8551926

Base URL:

https://r.nps.today

Unique survey link:

https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926
Rating links used in the rating boxes for your embedded survey will then look like this:
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=0
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=1
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=2
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=3
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=4
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=5
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=6
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=7
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=8
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=9
https://r.nps.today?id=81ad980e-a6ca-4ae4-a38e-d627d8551926&rating=10

Verify your setup

  1. Generate a single link with test values and open it in a browser.
  2. Submit a rating, then confirm the response and the mapped fields appear on the campaign in nps.today.
  3. For the script method, also generate one link in the app (Send Out Survey → Unique Personalized Link) with the same values and compare the sha. If they match, your secret and field order are correct, and you can move to production.

Tip

Test with one record before rolling out to a full list.


Need a hand? Reach out to nps.today support via the support page.