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 SDKif 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 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 state)
{
// Your code here
}

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

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

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

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

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

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

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

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

Class Usage:

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

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.

Conversation delegates

New Conversation Started

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.

Note

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

Conversation Ended

ConversationEnded

This delegate callback can be implemented to check if an ongoing Conversation has ended. This delegate is called whenever the ongoing Conversation is resolved, rejected from the Dashboard, timed out or archived.

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 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 HSUserAcceptedTheSolution = "User accepted the solution";
public static final String HSUserRejectedTheSolution = "User rejected the solution";
public static final String HSUserSentScreenShot = "User sent a screenshot";
public static final String HSUserReviewedTheApp = "User reviewed the app";
Note

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

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.

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, then we fall back to passing the file to the delegate handler in the app. There are two possible variants of the path parameter in HandleTapOnAttachmentFile(string path), one is FilePath and the other one is Uri.

  • On Android version 10 & above, path value will be a Uri path because Files are exposed with Uri objects by the OS.
  • On Android versions older than 10, path value will the File path
    public bool HandleTapOnAttachmentFile(String filePathOrUri)
{
if (filePathOrUri.StartsWith("content://", StringComparison.OrdinalIgnoreCase))
{
// your code here to handle uri
} else
{
// your code here to handle filePath
}
return true;
}

New message received 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.

Unread Messages Count Delegate

DidReceiveUnreadMessagesCount

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

User click on action delegate

UserDidClickOnActionWithTypeAndData

This delegate method is called when user clicks on an action in Action Card bot.

actionTypeThe type of action user clicked on. Can be one of: HelpshiftActionType.Link, HelpshiftActionType.Call
actionDataThe data associated with the action type. Can be a url link or a phone number.
    public void UserDidClickOnActionWithTypeAndData(HelpshiftActionType actionType, string data)
{
Toast.MakeText(this, "UserDidClickOnActionWithTypeAndData : " + actionType
+ ", with data : " + data, ToastLength.Short).Show();
}