How to display details of anonymous users in the chat module to your agents?

How to display details of anonymous users in the chat module to your agents?

When an anonymous user contacts the customer support agent via Chat, their details usually do not appear on the agent's screen. However, you can configure the ASAP help widget to display these details after receiving them from the user.

To configure this setting, use the following method:

Swift

  1. import ZohoDeskPortalSalesIQ
    ...
    ZDPortalSalesIQ.setGuestUser(email:<#Guest_User_Email#>,
    displayName:<#Guest_User_DisplayName#>",
    phoneNumber: <#Guest_User_PhoneNumber#>")

Objective-C

  1. @import ZohoDeskPortalSalesIQ;
    ...
    [ZDPortalSalesIQ setGuestUserWithEmail:<#Guest_User_Email#>
    displayName:<#Guest_User_DisplayName#>
    phoneNumber:<#Guest_User_PhoneNumber#>];
Additionally, agents can convert chat conversations into tickets if additional user interactions are required later. The email address is a mandatory parameter to make this conversion possible.

Programmatically adding tickets

While end-users can manually submit tickets through the ASAP help widget, you can also configure your app to record tickets automatically when certain events occur in the app. For instance, if you run a clothing business and your app fails to load the For Women screen when a user tries to access it, this failure instance can be automatically recorded as a ticket on your help desk. The user does not need to visit your help center and manually submit a ticket.

To make this automatic submission of tickets possible, incorporate the following methods in your app code:

Swift

  1. import ZohoDeskPortalAPIKit

Objective-C

  1. @import ZohoDeskPortalAPIKit;

To fetch the IDs of the departments in your help desk portal, use the following method:

Swift

  1. ZohoDeskPortalSDK.getDepartments(onCompletion:
    { (departments, error) in
    // on success, departments will return an array, error will return nil
    // on failure, error will return a value, departments will return nil
    }

Objective-C

  1. [ZohoDeskPortalSDK getDepartmentsOnCompletion:^
    (NSArray * departments, NSError * error)
    {
    // on success, departments will return an array, error will return nil
    // on failure, error will return a value, departments will return nil
    }];

Use the following method to fetch information of the products configured in a department:

Swift

  1. ZohoDeskPortalSDK.getProducts(inDepartmentID: <#T##String#>, params: <#T##[String : Any]?#>)
    { products, error in
    // on success, products will return an array, error will return nil
    // on failure, error will return a value, products will return nil
    }

Objective-C

  1. [ZohoDeskPortalSDK getProductsInDepartmentID:<#NSString#>
    params:<#NSDictionary#>onCompletion:^
    (NSArray * products, NSError * error)
    {
    // on success, products will return an array, error will return nil
    // on failure, error will return a value, products will return nil
    }];

To fetch the fields configured in the ticket layout of a department, use the following method:

Swift

  1. ZohoDeskPortalSDK.Ticket.getFields(<#T##params: [String : Any]?##[String : Any]?#>)
    { fields, error in
    // on success, fields will return an array, error will return nil
    // on failure, error will return a value, products will return nil
    }

Objective-C

  1. [[ZohoDeskPortalSDKTicket getFields:
    <#(NSDictionary * _Nullable)#>onCompletion:^
    (NSArray * fields, NSError * error)
    {
    // on success, fields will return an array, error will return nil
    // on failure, error will return a value, fields will return nil
    }];

To include a file attachment in the Ticket, use the following method:

Swift
  1. ZohoDeskPortalSDK.Ticket.addAttachment(with:<#Data#>,
    andName:<#String#>, using: <#ZDPUploaderDelegate?#>)
    { (attachment, error) in
    // on success, attachment will return a value, error will return nil
    // on failure, error will return a value, attachment will return nil
    }

Objective-C

  1. [ZohoDeskPortalSDKTicket addAttachmentWith:
    <#NSData#>andName:<#NSString#>using:
    <#(id _Nullable)#>onCompletion:^
    (ZDPortalAttachment * attachment, NSError * error)
    {
    // on success, attachment will return a value, error will return nil
    // on failure, error will return a value, attachment will return nil
    }];

To make this automatic ticket submission possible, incorporate the following method into your app code. You must call different methods to post tickets for authenticated and unauthenticated users:

Swift

  1. if ZohoDeskPortalSDK.isUserLoggedIn
    {
        ZohoDeskPortalSDK.Ticket.add(withFields:<#T##[String : Any]#>)
        { (ticket, error) in
       // on success, ticket will return an object,
    error will return nil
       // on failure, error will return a value,
    ticket will return nil
        }
    } else
    {
        ZohoDeskPortalSDK.Ticket.addAsGuest
    (withFields: <#T##[String : Any]#>)
        { (ticketNumber, error) in
        // on success, ticketNumber will return a string value,
    error will return nil
        // on failure, error will return a value,
    ticketNumber will return nil
        }
    }

Objective-C

  1. if (ZohoDeskPortalSDK.isUserLoggedIn)
    {
            [ZohoDeskPortalSDKTicket addWithFields:<#(NSDictionary * _Nonnull)#> onCompletion:^(ZDPTicket * ticket, NSError * error)
        {
             // on success, ticket will return an object, error will return nil
             // on failure, error will return a value, ticket will return nil
            }];
    }
    else
    {
            [ZohoDeskPortalSDKTicket addAsGuestWithFields:
            <#(NSDictionary * _Nonnull)#> onCompletion:^(NSString * ticketNumber, NSError * error)
            {
             // on success, ticketNumber will return a string value, error will return nil
             // on failure, error will return a value, ticketNumber will return nil
            }]
    }
NotesEmail Address, Subject, and DepartmentID are mandatory parameters in the method call.