zoho / salesiq-mobilisten-flutter

SalesIQ Mobilisten plugin for Flutter.
https://mobilisten.io
MIT License
12 stars 10 forks source link

Visitor Tracking #16

Closed gdlin closed 1 year ago

gdlin commented 2 years ago

Hello, I'm trying to set my user's info but it doesn't seem to be working.

I've tried the following:

await ZohoSalesIQ.registerVisitor(uuid); // uuid is my user's ID, I've also tried without registering the user.
await ZohoSalesIQ.setVisitorName('John Doe');  
await ZohoSalesIQ.setVisitorEmail('test@example.com');
await ZohoSalesIQ.setVisitorLocation(SIQVisitorLocation()
    ..country = 'US');
await ZohoSalesIQ.setVisitorAddInfo('Company', 'Company Name');

I've tried both awaiting and not, and it doesn't seem to change at all. I've added the following: ZohoSalesIQ.setVisitorNameVisibility(true); but it doesn't seem to change things. Either I'm doing something wrong, or there is a problem with the API. I'm not getting any errors, but I'm not seeing any of that info in the Visitor's info, on the SalesIQ panel.

bhahirathan-mb-11956 commented 2 years ago

Hi @gdlin,

Thank you for writing us.

In the latest version, the setVisitorName API has an issue when it's used on the immediate callback of ZohoSalesIQ.init(..). We're looking into this and will update you when there are new version updates.

Please check the if following parameters are correct in your project:

  1. The visitor's unique id used for registering should match the regex pattern -> "^[A-Za-z0-9_@.\-]{1,100}$" - documentation.
  2. Please confirm that the registerVisitor(..) and all other APIs are called after the SDK is initialized successfully.
  3. ZohoSalesIQ.setVisitorNameVisibility(true) API is used to show the visitor name above the visitor's message in chat window - documentation.

and it is also not necessary to call any of the methods using await.

Example snippet:

ZohoSalesIQ.init(appkey, accessKey).then((value) {
    ZohoSalesIQ.registerVisitor("visitorUniqueID");   
    ZohoSalesIQ.setVisitorEmail('test@example.com');
    ZohoSalesIQ.setVisitorContactNumber("1234567");
}).catchError((onError) {

});

I hope this helps. Feel free to write us at (support@zohosalesiq.com) along with your GitHub ID for further assistance.

Regards, Bhahirathan M.

yasinarik commented 2 years ago

Hello @DavidBhahirathan 👋

I am facing the same problem and I follow async method chaining practices. (I am sure that it awaits and I added 3 seconds between each method of code for debugging purposes).

It doesn't work for now. Apart from registering the user, I also want to set the user name, email, and other custom properties before the chat starts. I also designed a chatbot (Zobot) and works very well but I want to pre-fill some of the questions that the chat robot asks.


  Future<void> initFlow() async {
    await setTestData();
    await Future.delayed(const Duration(milliseconds: 3000));
    await initialize();
    await Future.delayed(const Duration(milliseconds: 3000));
    await addEventListener();
    await Future.delayed(const Duration(milliseconds: 3000));
    await setConfigs();
    await Future.delayed(const Duration(milliseconds: 3000));
    await registerUser();
    await Future.delayed(const Duration(milliseconds: 3000));
    await setUserFields();
  }

Inside of registerUser =>

registerUserResult = await ZohoSalesIQ.registerVisitor(testData.id);

Inside of setUserFields =>

await ZohoSalesIQ.setVisitorName(testData.name);
await ZohoSalesIQ.setVisitorEmail(testData.email);
await ZohoSalesIQ.setVisitorAddInfo('favoriteFood', testData.foodName);

The unique id I use is some 8-character long number 95564788. Also for testing, I add this identifier after each string value as a suffix such as:

Name: yasin95564788
Email: yasin.95564788@gmail.com
Address: some street, some city 95564788
Company: ACME Industries 95564788

This is very important and will affect our tech team's decision.

bhahirathan-mb-11956 commented 2 years ago

Hi @yasinarik ,

Thanks for writing us. The registerVisitor method returns a Future value, so can you please check its result using the code below and let us know what result is printed on the logcat?

As mentioned in the above comment, in the latest version, the setVisitorName API has an issue when it's used on the immediate callback of ZohoSalesIQ.init(..). We've fixed this issue in our current development and will update you when it's live.

ZohoSalesIQ.setVisitorEmail(..) and ZohoSalesIQ.setVisitorAddInfo(..) will work fine if it's provided like the below snippet.

Note: Please set the visitor email in the correct mail format.

ZohoSalesIQ.init(appkey, accessKey).then((value) {
          ZohoSalesIQ.registerVisitor("visitor_id").then((value) =>
              print("Register visitor result: " + value));
          ZohoSalesIQ.setVisitorEmail(testData.email);
          ZohoSalesIQ.setVisitorAddInfo('favoriteFood', testData.food);
        }).catchError((onError) {

        });

Regards, Bhahirathan M.

bhahirathan-mb-11956 commented 1 year ago

Hi @gdlin and @yasinarik ,

The above reported issue have been addressed in the version 2.0.0.

Regards, Bhahirathan M, Zoho SalesIQ.

yasinarik commented 1 year ago

Hi @gdlin and @yasinarik ,

The above reported issue have been addressed in the version 2.0.0.

Regards, Bhahirathan M, Zoho SalesIQ.

Hello @DavidBhahirathan , the 2.0.0 link goes to a react native repo. Am I wrong?

bhahirathan-mb-11956 commented 1 year ago

Sorry for the inconvenience @yasinarik I have updated the comment please check it now.