Send a survey via API
Our API gives acces to all your survey data. It also allows you to trigger your survey programmatically. This method is ideal if you want to integrate the survey into your existing workflow or application.
The API provides two endpoints:
- /send: This endpoint allows you to send a survey to a specific contact via email, Naxai Survey platform handles the transport of the survey to the contact, and you can specify the language.
- /createlink: This endpoint generates a survey link that can be distributed to contacts outside of Naxai Survey platform. The link can be either a short URL or a long URL, depending on your preferences
To use the API, you will need to obtain an client ID and client secret, which can be generated on the platform by navigating to Integrations and API credentials, where API Credentials can be managed and Client Secrets rotated. More information on this topic can be found here.
To send a survey, you will need to make an HTTP POST request to the Naxai API using the following endpoint:
curl --location 'https://api.naxai.com/survey/1218ee3b-f55b-4eb8-b716-d42f66223429/send' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"channel": "email",
"contactId": "01ea3ea3-bde0-4e49-9e34-4cbb9e822ded",
"surveyData": {
"agentName": "Smith",
"transactionId": "xc42"
}
}'
import requests
import json
url = "https://api.naxai.com/survey/1218ee3b-f55b-4eb8-b716-d42f66223429/send"
payload = json.dumps({
"channel": "email",
"contactId": "3b1ecdac-a499-4ce4-b669-c2c907b67eda",
"surveyData": {
"agentName": "Smith",
"transactionId": "xc42"
}
})
headers = {
'Content-Type: application/json',
'Accept: application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
Find all our API references here.
Updated about 1 year ago
What’s Next