Helpshift Support Delegates

The Helpshift SDK provides delegate callbacks to help app developers track a user's activities within the help section.

Helpshift Support Delegates implementation

You have to define a class which implements Helpshift Support Delegates and then pass this to Helpshift using Support.setDelegate() method.

For example:

Class Implementation:

import com.helpshift.support.Delegate
...
...

class MyDelegates implements Delegate {
  @Override
  public void sessionBegan() {
    // your code here
  }

  @Override
  public void sessionEnded() {
    // your code here
  }

  @Override
  public void newConversationStarted(String newConversationMessage) {
    // your code here
  }

  @Override
  public void userRepliedToConversation(String newMessage) {
    // your code here
  }

  @Override
  public void userCompletedCustomerSatisfactionSurvey(int rating, String feedback) {
    // your code here
  }

  @Override
  public void displayAttachmentFile(File attachmentFile) {
    // your code here
  }

  @Override
  public void didReceiveNotification(int newMessagesCount) {
    // your code here
  }
}

Class Usage:

MyDelegates delegates = new MyDelegates();
Support.setDelegate(delegates);

Please make sure you call setDelegate method before calling any Helpshift FAQ or Conversation API so that they can callback your delegate methods.

To know more about Delegate methods, see Helpshift Session delegates.

Helpshift Session delegates

Session begin

sessionBegan

If you want to keep track of when helpshift session starts in your app, you can implement this delegate callback. The delegate will get fired every time the Helpshift session starts.

Session end

sessionEnded

If you want to keep track of when helpshift session ends in your app, you can implement this delegate callback. The delegate will get fired every time the Helpshift session ends.

New conversation delegate

newConversationStarted

If you want to keep track of when your app users start a new conversation through Helpshift, you can implement this delegate callback . The delegate will get fired every time the user starts a new conversation. The delegate method will receive the conversation message in it's arguments.

For example:

public void newConversationStarted (String newConversationMessage) {
  // your code here
}

New message delegate

userRepliedToConversation

If you want to keep track of when your app users send new messages to an ongoing conversation, you can implement this delegate. This delegates will get called every time a user replies to a conversation. The delegate method will receive the new message's content in it's arguments. if the message is of a special type then it will be one of the following four messages.

public static final String UserAcceptedTheSolution = "User accepted the solution";
public static final String UserRejectedTheSolution = "User rejected the solution";
public static final String UserSentScreenShot = "User sent a screenshot";
public static final String UserReviewedTheApp = "User reviewed the app";

For example:

public void userRepliedToConversation (String newMessage) {
  if (newMessage.equals(Support.UserAcceptedTheSolution)) {
    // your code here
  }
}

Customer satisfaction survey delegate

userCompletedCustomerSatisfactionSurvey

If you want to keep track of when your app user completes the customer satisfaction survey for a conversation, you can implement this delegate. This delegates will get called every time a user completes the customer satisfaction survey. The delegate method will receive the rating and the feedback in it's arguments.

For example:

public void userCompletedCustomerSatisfactionSurvey (int rating, String feedback) {
  if (rating < 3) {
    // your code goes here
  }
}

Display attachment delegate

displayAttachmentFile

Agents can attach a wide variety of files when replying to users. Following types of file formats are currently supported:

  • Video files (3gp, m4v)
  • Audio files (mp3, mp4, aac)
  • Image files (jpg, png, gif)

After the attachment is downloaded, helpshift checks for any app which can open it. if no such app is found than we fall back to passing the file to the delegate handler in the app.

New message received count delegate

didReceiveNotification

If you want to keep a count of all new messages recieved in an existing conversation, you can implement this delegate. This delegate will get called with the current unread count every time when helpshift recieves a new message in an existing conversation. You can also use this delegate to keep your badge counts updated.

For example:

public void didReceiveNotification (int newMessagesCount) {
    // your code goes here
}