Custom Invitation API
As touched on in Invitation Modes, Trigger supports four invitation modes:
- In Session (previously 'Immediate')
- Contact (previously 'On-Exit')
- Exit Survey (previously 'Local')
- Exit Invite
By default, Trigger uses a predefined layout and design to display the invitation for all these invitation modes. Although it is now possible to define your own UI using the ForeSee® Custom Invitation API. Please see Custom Layout for more information.
Default Layout
By default, Trigger uses this default layout and design to show the invitation to the user for all these invitation modes.


Custom Layout
You can customize your invitation by implementing one of the CustomContactInviteListener, CustomInSessionInviteListener, or CustomLocalInviteListener listeners (based on your invitation mode). You can learn more about this from ForeSee's Sample Application on GitHub.
The following list of methods are available in this listener that you can use in order to customize the invitation experience.
For more information, please refer to API documentation.
showInvite
onContactFormatError
onContactMissing
onInviteCompleteWithAccept
onInviteCompleteWithDecline
onInviteCancelledWithNetworkError
onInviteNotShownWithNetworkError
onInviteNotShownWithEligibilityFailed
onInviteNotShownWithSamplingFailed
The following list of methods are available in this listener that you can use in order to customize the invitation experience.
For more information, please refer to API documentation.
showInvite
onSurveyPresented
onSurveyCompleted
onSurveyCancelledByUser
onSurveyCancelledWithNetworkError
onInviteCompleteWithAccept
onInviteCompleteWithDecline
onInviteNotShownWithNetworkError
onInviteNotShownWithEligibilityFailed
onInviteNotShownWithSamplingFailed
The following list of methods are available in this listener that you can use in order to customize the invitation experience.
For more information, please refer to API documentation.
showInvite
onInviteCompleteWithAccept
onInviteCompleteWithDecline
onInviteNotShownWithNetworkError
onInviteNotShownWithEligibilityFailed
onInviteNotShownWithSamplingFailed
Preferred Contact Type
You can specify a preferred contact type in the SDK. The preferred contact type is used for determining which contact to use when a custom invitation is triggered.
For more information, please refer to API documentation.
setPreferredContactType
getPreferredContactType
A Simple Example
ForeSee.setInviteListener(new CustomContactInviteListener() {
@Override
public void showInvite(EligibleMeasureConfigurations measures) {
// The SDK is ready to show an invitation.
// This is where you should show your invitation UI.
// You can pass the user's contact information at any point
// using ForeSee.setContactDetails("555-555-5555")
// and inform the SDK whether they accepted or declined the invitation
// using ForeSee.customInviteAccepted() and
// ForeSee.customInviteDeclined().
}
@Override
public void onContactMissing() {
// The user's contact information (Email/phone) is required
// but was not provided.
// You should ask the user to provide the contact info
// and use ForeSee.setContactDetails("5555555555")
// to pass the contact information to the SDK,
// followed by ForeSee.customInviteAccepted().
}
@Override
public void onContactFormatError() {
// The user contact information format is invalid.
// Ask the user to correct the contact information
// and use ForeSee.setContactDetails("[email protected]")
// to pass the correct information to the SDK,
// followed by ForeSee.customInviteAccepted().
}
@Override
public void onInviteCompleteWithAccept(EligibleMeasureConfigurations measures) {
// By this point, the SDK is finished with the invitation process.
// This is for information only
Toast.makeText(getApplicationContext(),
"A survey will be sent to " + ForeSee.getContactDetails(),
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteCompleteWithDecline(EligibleMeasureConfigurations measures) {
Toast.makeText(getApplicationContext(),
"Invitation declined by user.",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteCancelledWithNetworkError() {
Toast.makeText(getApplicationContext(),
"Invitation cancelled with network error.",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteNotShownWithNetworkError(EligibleMeasureConfigurations measures) {
Toast.makeText(getApplicationContext(),
"Invitation not shown with network error.",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteNotShownWithEligibilityFailed(EligibleMeasureConfigurations measures) {
Toast.makeText(getApplicationContext(),
"Invitation not shown with eligibility failed.",
Toast.LENGTH_SHORT).show();
}
@Override
public void onInviteNotShownWithSamplingFailed(EligibleMeasureConfigurations measures) {
Toast.makeText(getApplicationContext(),
"Invitation not shown with sampling failed.",
Toast.LENGTH_SHORT).show();
}
});
Updated over 3 years ago