Thought about generating unique survey links in bulk specific to users using Google Sheets?

function generateLink() {
    const authorizationToken = "Bearer prp0lVEtQLv0mZRe0dzdFlVY-sb0WNUPZdGq5UcAoQoJFQQqBYF3avAQYzshNPa2ABF0DR6zzzfb6Ou5leuyTGGg";
    
    const headers = {
      "Authorization": authorizationToken,
      "Content-Type": "application/json"
    };

    const getContactUrl = (email) => `https://api.surveysparrow.com/v3/contacts?search=${email}`;
    const contactOption = { headers };

    const uniqueLinkUrl = "https://api.surveysparrow.com/v3/channels/create_unique_links";

    const uniqueLinkOptions = ({ contact_ids }) => ({
      "method": "post",
      headers,
      "payload": JSON.stringify({
        "survey_id": 605504,
        "channel_id": 4401235,
        contact_ids
      })
    });

    const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
    const getEmails = sheet.getRange("D:D").getValues();

    for (let i = 1; i < getEmails.length; i++) {
      const email = getEmails[i][0];
      const cellValue = sheet.getRange(`E${i+1}`).getValue();

      if (!email || cellValue) continue;

      const contactUrl = getContactUrl(email);
      const response = UrlFetchApp.fetch(contactUrl, contactOption);
      console.log("Generating survey link for", { email, cellValue });

      try {
        const id = JSON.parse(response.getContentText()).data[0].id;
        let uniqueLink = UrlFetchApp.fetch(uniqueLinkUrl, uniqueLinkOptions({ contact_ids: [id] }));
        uniqueLink = JSON.parse(uniqueLink.getContentText()).data[0].survey_link;

        sheet.getRange(`E${i+2}`).setValue(uniqueLink);
      } catch (e) {
        console.log(e.message);
        continue;
      }
    }
  }

  function addMenu() {
    const menu = SpreadsheetApp.getUi().createMenu("Custom");
    menu.addItem("Generate Survey Link", "generateLink").addToUi();
  }

  function onOpen() {
    addMenu();
  }