Skip to main content

Helpshift Delegates

Important
Helpshift’s Legacy SDKs (SDK Version <=7.x.x) reached their end of life on 31 Dec 2022, and end of support on 31 March 2023. Please upgrade to the Latest SDK if you haven't already.

Helpshift Delegates

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

Helpshift Delegates implementation

You have to define a class which implements Helpshift Delegates, and then pass this to Helpshift using the HelpshiftSupport.SetDelegate(ISupportDelegate delegateInstance) method.

For example:

Class Implementation:

using HelpshiftApi;

public class HSDelegate : ISupportDelegate {

public HSDelegate () {

}

public void AuthenticationFailed(HelpshiftUser user, AuthenticationFailureReason reason)
{
// Your code here
}

public void ConversationEnded()
{
// Your code here
}

public void DidCheckIfConversationActive(bool isActive)
{
// Your code here
}

public void DidReceiveNotification(int count)
{
// Your code here
}

public void DidReceiveUnreadMessagesCount(int count)
{
// Your code here
}

public bool HandleTapOnAttachmentFile(string path)
{
// Your code here
}

public void NewConversationStarted(string message)
{
// Your code here
}

public void SessionBegan()
{
// Your code here
}

public void SessionEnded()
{
// Your code here
}

public void UserCompletedCustomerSatisfactionSurvey(int rating, string feedback)
{
// Your code here
}

public void UserRepliedToConversation(string reply)
{
// Your code here
}
}

Class Usage:

HSDelegate delegateObject = new HSDelegate ();
HelpshiftApi.HelpshiftSupport.SetDelegate(delegateObject);

Please make sure you call the 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 be fired every time the user starts a new conversation. The delegate method will receive the conversation message in its arguments.

Note

As soon as an end user opens the conversation screen, they see a greeting message, and the conversation is considered active.

Conversation Active

DidCheckIfConversationActive

This delegate callback can be implemented to check if a Conversation is active when queried via HelpshiftApi.HelpshiftSupport.CheckIfConversationActive()

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 its arguments. if the message is of a special type then it will be one of the following four messages.


public const String HSUserAcceptedTheSolution = "User accepted the solution";
public const String HSUserRejectedTheSolution = "User rejected the solution";
public const String HSUserSentScreenShot = "User sent a screenshot";
public const String HSUserReviewedTheApp = "User reviewed the app";

Note

All the replies from end users to Bot (QuickSearch Bot, Identity Bot) are also considered as new messages added by end users.

Conversation ended delegate

ConversationEnded

This delegate is called whenever the ongoing Conversation is resolved, rejected from the Dashboard, timed out or archived.

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.

Handle attachment file delegate

HandleTapOnAttachmentFile

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 end user taps on a downloaded attachment, helpshift tries to call the HandleTapOnAttachmentFile delegate(if implemented) and check its return value. If the delegate returns true, then SDK assumes that the host app has handled the opening of attachment and does not take any further action.

If the delegate is not implemented or the delegate returns false, SDK tries to preview it using QLPreviewController.

Did Receive Notification Count Delegate

DidReceiveNotification

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

Did Receive Unread Messages Count

DidReceiveUnreadMessagesCount

This delegate can be implemented to get the count of unread messages queried via HelpshiftApi.HelpshiftSupport.RequestUnreadMessagesCount(bool)

Action card delegate

This delegate method is called when user clicks on action card button. The HelpshiftActionType actionType parameter can be one of:

  • Link
  • Call

The data parameter can be url/phoneNumber based on actionType

Example:


public void UserDidClickOnActionWithTypeAndData(HelpshiftActionType actionType, string data)
{
// your code here
}