const response = await api.followups.generate({
surveyName: 'Customer Satisfaction',
question: 'How likely are you to recommend our service?',
answer: 'Very likely, the customer service is excellent',
surveyIdentifiers: {
surveyIdentifier: 'CSAT-2024-Q1',
questionIdentifier: 'NPS-1'
}
});response = api.followups.generate(
survey_name='Customer Satisfaction',
question='How likely are you to recommend our service?',
answer='Very likely, the customer service is excellent',
surveyIdentifiers={
'survey_identifier': 'CSAT-2024-Q1',
'question_identifier': 'NPS-1'
}
)curl --request POST \
--url https://surveys.getaftercare.com/api/v1/followups \
--header 'Content-Type: application/json' \
--header 'X-Aftercare-Key: <api-key>' \
--data '
{
"surveyName": "Customer Satisfaction",
"surveyDescription": "Tracking customer satisfaction and loyalty for the XYZ Company",
"question": "How likely are you to recommend our service?",
"questionContext": "I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.",
"answer": "Very likely, the customer service is excellent",
"surveyIdentifiers": {
"surveyIdentifier": "CSAT-2024-Q1",
"questionIdentifier": "NPS-1"
},
"guidanceBehavior": "Verbose"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://surveys.getaftercare.com/api/v1/followups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'surveyName' => 'Customer Satisfaction',
'surveyDescription' => 'Tracking customer satisfaction and loyalty for the XYZ Company',
'question' => 'How likely are you to recommend our service?',
'questionContext' => 'I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.',
'answer' => 'Very likely, the customer service is excellent',
'surveyIdentifiers' => [
'surveyIdentifier' => 'CSAT-2024-Q1',
'questionIdentifier' => 'NPS-1'
],
'guidanceBehavior' => 'Verbose'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Aftercare-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://surveys.getaftercare.com/api/v1/followups"
payload := strings.NewReader("{\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"question\": \"How likely are you to recommend our service?\",\n \"questionContext\": \"I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.\",\n \"answer\": \"Very likely, the customer service is excellent\",\n \"surveyIdentifiers\": {\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"questionIdentifier\": \"NPS-1\"\n },\n \"guidanceBehavior\": \"Verbose\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Aftercare-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://surveys.getaftercare.com/api/v1/followups")
.header("X-Aftercare-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"question\": \"How likely are you to recommend our service?\",\n \"questionContext\": \"I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.\",\n \"answer\": \"Very likely, the customer service is excellent\",\n \"surveyIdentifiers\": {\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"questionIdentifier\": \"NPS-1\"\n },\n \"guidanceBehavior\": \"Verbose\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://surveys.getaftercare.com/api/v1/followups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Aftercare-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"question\": \"How likely are you to recommend our service?\",\n \"questionContext\": \"I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.\",\n \"answer\": \"Very likely, the customer service is excellent\",\n \"surveyIdentifiers\": {\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"questionIdentifier\": \"NPS-1\"\n },\n \"guidanceBehavior\": \"Verbose\"\n}"
response = http.request(request)
puts response.read_body{
"followupQuestion": "What specific aspects of our customer service impressed you the most?",
"responseEvaluation": {
"completeness": 75,
"relevance": 90
},
"threadId": "7a54b8da-f65d-4946-9c9a-f202e0cc29c8",
"responseIdentifier": "12345"
}{
"code": "INVALID_REQUEST",
"message": "Invalid request parameters",
"details": {
"question": "Question is required"
}
}{
"code": "INVALID_API_KEY",
"message": "Invalid or missing API key"
}{
"code": "NOT_FOUND",
"message": "Requested resource not found"
}{
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}{
"code": "GATEWAY_TIMEOUT",
"message": "The request timed out"
}Create AI Followup Question
Generates a contextual followup question based on a survey response
const response = await api.followups.generate({
surveyName: 'Customer Satisfaction',
question: 'How likely are you to recommend our service?',
answer: 'Very likely, the customer service is excellent',
surveyIdentifiers: {
surveyIdentifier: 'CSAT-2024-Q1',
questionIdentifier: 'NPS-1'
}
});response = api.followups.generate(
survey_name='Customer Satisfaction',
question='How likely are you to recommend our service?',
answer='Very likely, the customer service is excellent',
surveyIdentifiers={
'survey_identifier': 'CSAT-2024-Q1',
'question_identifier': 'NPS-1'
}
)curl --request POST \
--url https://surveys.getaftercare.com/api/v1/followups \
--header 'Content-Type: application/json' \
--header 'X-Aftercare-Key: <api-key>' \
--data '
{
"surveyName": "Customer Satisfaction",
"surveyDescription": "Tracking customer satisfaction and loyalty for the XYZ Company",
"question": "How likely are you to recommend our service?",
"questionContext": "I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.",
"answer": "Very likely, the customer service is excellent",
"surveyIdentifiers": {
"surveyIdentifier": "CSAT-2024-Q1",
"questionIdentifier": "NPS-1"
},
"guidanceBehavior": "Verbose"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://surveys.getaftercare.com/api/v1/followups",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'surveyName' => 'Customer Satisfaction',
'surveyDescription' => 'Tracking customer satisfaction and loyalty for the XYZ Company',
'question' => 'How likely are you to recommend our service?',
'questionContext' => 'I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.',
'answer' => 'Very likely, the customer service is excellent',
'surveyIdentifiers' => [
'surveyIdentifier' => 'CSAT-2024-Q1',
'questionIdentifier' => 'NPS-1'
],
'guidanceBehavior' => 'Verbose'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Aftercare-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://surveys.getaftercare.com/api/v1/followups"
payload := strings.NewReader("{\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"question\": \"How likely are you to recommend our service?\",\n \"questionContext\": \"I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.\",\n \"answer\": \"Very likely, the customer service is excellent\",\n \"surveyIdentifiers\": {\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"questionIdentifier\": \"NPS-1\"\n },\n \"guidanceBehavior\": \"Verbose\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Aftercare-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://surveys.getaftercare.com/api/v1/followups")
.header("X-Aftercare-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"question\": \"How likely are you to recommend our service?\",\n \"questionContext\": \"I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.\",\n \"answer\": \"Very likely, the customer service is excellent\",\n \"surveyIdentifiers\": {\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"questionIdentifier\": \"NPS-1\"\n },\n \"guidanceBehavior\": \"Verbose\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://surveys.getaftercare.com/api/v1/followups")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Aftercare-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"surveyName\": \"Customer Satisfaction\",\n \"surveyDescription\": \"Tracking customer satisfaction and loyalty for the XYZ Company\",\n \"question\": \"How likely are you to recommend our service?\",\n \"questionContext\": \"I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why.\",\n \"answer\": \"Very likely, the customer service is excellent\",\n \"surveyIdentifiers\": {\n \"surveyIdentifier\": \"CSAT-2024-Q1\",\n \"questionIdentifier\": \"NPS-1\"\n },\n \"guidanceBehavior\": \"Verbose\"\n}"
response = http.request(request)
puts response.read_body{
"followupQuestion": "What specific aspects of our customer service impressed you the most?",
"responseEvaluation": {
"completeness": 75,
"relevance": 90
},
"threadId": "7a54b8da-f65d-4946-9c9a-f202e0cc29c8",
"responseIdentifier": "12345"
}{
"code": "INVALID_REQUEST",
"message": "Invalid request parameters",
"details": {
"question": "Question is required"
}
}{
"code": "INVALID_API_KEY",
"message": "Invalid or missing API key"
}{
"code": "NOT_FOUND",
"message": "Requested resource not found"
}{
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}{
"code": "GATEWAY_TIMEOUT",
"message": "The request timed out"
}Authorizations
API key for authentication
Headers
Specifies the encoding format of the request data. Use html if you are sending data that HTML entity encodes non-ASCII characters.
unicode, html Specifies the preferred encoding format for the response data. Use html if you are expecting to receive data that HTML entity encodes non-ASCII characters.
unicode, html Body
The question that was asked to the respondent
"How likely are you to recommend our service?"
The answer to the question provided by the respondent
"Very likely, the customer service is excellent"
The name of the survey as it will appear in the Aftercare platform
"Customer Satisfaction"
A description of the survey purpose and background.
It will be used to give the AI more context around specific aspects of the survey (e.g. brand/product names, movie names, etc.)
"Quarterly survey tracking customer satisfaction and loyalty for the XYZ Company"
A description of what you are trying to learn from the respondent for this question.
This will be used to give the AI guidance on what followup questions to ask.
"I want to understand specifically why a customer is convinced to recommend our service. If they are not recommending our service, I want to know why."
Optional identifiers to tie responses to a specific survey and question. If provided, Aftercare will use these to generate analytics over your survey responses.
If included, both survey and question identifiers are required.
See the Aftercare Data Model to learn more.
Show child attributes
Show child attributes
Optional language to use for the followup question generation.
If not provided, Aftercare will default to the language it determines best matches the response.
Set response language to match_response_language to automatically set the language of the generated follow up question to the language of the respondent's answer.
"French"
A unique identifier for the follow-up response thread.
If provided, Aftercare will follow-up questions and answers in a thread with the original question and answer.
If not provided, Aftercare will automatically generate a new thread id you can use in a subsequent follow-up.
"7a54b8da-f65d-4946-9c9a-f202e0cc29c8"
Optional unique identifier for a respondent's entire response to a survey.
Aftercare will use this to build a data model tie together questions and answer pairs for a single response.
"12345"
Different ways Aftercare AI will generate follow-up questions based on incomplete or irrelevant user input.
Succinct- The AI will not generate a follow-up question if the response is irrelevant or complete. This occurs when the relevance score is below 25 or the completeness score is above 70. This is the default behavior.Redirection- The AI will return a follow-up question that redirects the user to answering the top-level question if it is irrelevant and incomplete. A follow-up question will be generated as long as the completeness score is below 70.Verbose- The AI will always return a follow-up question regardless of the relevance or completeness of the response.
Succinct, Redirection, Verbose Response
Successfully generated followup question
The generated followup question
"What specific aspects of our customer service impressed you the most?"
Show child attributes
Show child attributes
The unique identifier for the follow-up thread
"7a54b8da-f65d-4946-9c9a-f202e0cc29c8"
Optional identifier for the survey response
"12345"

