Is it possible to pass a Custom Data from the contact list into an external URL?

255 Views Asked by At

More specifically, what URL query parameter should I use to pass in a custom data into my URL, if possible?

For instance, I would like to pass in Custom Data 3 to my URL in the format www.website.com/?Custom3=${CustomData3}

("${CustomData3}" does not work.)

I have already asked customer support, but they said it was impossible. I was wondering if anyone else tried to do this and succeeded.

1

There are 1 best solutions below

0
On

I'm not exactly sure what you are asking for. If you're asking if there is a way to automatically pipe custom data into an external URL, then no there isn't a way within SurveyMonkey to do that. You can pipe custom contact data into a Survey.

But you can manually pipe contact data yourself into an external URL using the API.

For example, you would fetch the contact details:

GET /v3/contacts/<contact_id>

Which will return a response with the details for that contact:

response = {
  "id": "1234",
  "first_name": "John",
  "last_name": "Doe",
  "email": "[email protected]",
  "custom_fields": {
    "1": "Mr",
    "2": "Company",
    "3": "Address",
    "4": "City",
    "5": "Country",
    "6": "Phone Number"
  }
}

And then build the URL like:

url = "www.website.com/?Custom3=" + response["custom_fields"]["3"]

And then redirect the user to that URL yourself. You can write a function that reads a string and replaces ${<variable_name>} with the associated custom value (or use any templating engines in whatever programming language you're using e.g. mustache).