SurveyURLAPI
The purpose of the Survey URL API is to give clients a way to launch a post chat survey. The API returns a URL which must be opened in an external browser or in a Webview. This API must be invoked prior to making close Engagement API request.
SDK also provides an easy way of retreiving surveyURL if agent left the conversation before User initiates the close. NuanMessaging.getInstance().getSurveyURL(), This only fetches surveyURL if agent closes the engagement before user click close button.
Public Methods
-
public void getSurveyData(final OnSuccessListener<SurveyUrlResponse> success, OnErrorListener errorListener)
This retrieves the survey URL for this active engagement. OnSuccessListener.onResponse method is invoked upon a successfull request.
SurveyUrlResponse
Public Methods
-
public String getSurveyUrl()
Returns the survey URL.
-
public String getSurveyLaunchData()
Returns the survey launch data. Launch Data must be appended to the URL as a query parameter.
Response
OnErrorListener.onErrorResponse method receives an instance of Response class.
Public Methods
-
public int getStatusCode()
getStatusCode method returns following values which denotes the status of this request.
400: Request has incorrect parameters.
403: The user does not have sufficient privileges to use the API or to access the requested site.
500: Server error.
SurveyURLAPI surveyurl = new SurveyURLAPI();
surveyurl.getSurveyData(new OnSuccessListener<SurveyUrlResponse>() {
@Override
public void onResponse(SurveyUrlResponse response) {
webView = (WebView) findViewById(R.id.webview);
webView.loadUrl(response.getSurveyUrl()+"?"+response.getSurveyData());
}
}, new OnErrorListener() {
@Override
public void onErrorResponse(Response response) {
System.out.println(response.getStatusCode());
}
});