Cloudkibo / Kibo_Client_iOS

0 stars 0 forks source link

Create Chat Session #21

Closed sumairasaeed closed 8 years ago

sumairasaeed commented 8 years ago

Before starting chat, we will initiate creation of session as discussed with @zarmeen

jekram commented 8 years ago

We need to have a better description on what and why we ae doing. Please send a flow chart comparing the current KiboChart implementation with this implementation. Why the change?

sumairasaeed commented 8 years ago

In KiboChat, there is no concept of creating session. All the users join same room "global chat room" and we already know the unique phone number of all the contacts. We use "phone number" to identify contact and send chat message.

However, in kibo engage, we have no mechanism to directly send chat message to an agent. Thus, we need to create a session(ticket). We send a session joining request to server, server joins us to a room and creates a session. All the agents UI will change when a new ticket is created. Agents will get to know that a customer is waiting. Then session is picked by an agent. Mobile client will receive "Agent ID" through push notification. Mobile client will then use this "Agent ID" as unique identifier to send chat message to that specific agent only. Chat will not be visible to any other agent then.

Here are the flowcharts of KiboChat and Kibo Engage: image

Flow chart for Chat of Kibo Engage: image

jekram commented 8 years ago

@sumairasaeed @sojharo

We are creating an SDK that will be embedded in the host app. What fields are we expecting to be passed between Host App and SDK? We should be flexible so some customer may only pass a name, some customer may pass name and email

Should this information not be sent once not for each group and channel?

If a company has three groups and three channels, then each user would have nine chat channels. Correct?

So the first time any chat comes is why we would define at 9 chat channels? I am just trying to understand what is the pro and cons of building this one at a time vs. building all once the first interaction happens?

This logic assumes that all conversation on that channel starts with the consumer. Which is absolutely correct for support. I am not sure if there are other use cases where the agent initiates the first conversation.

Where are we sending the SMS broadcast?

My guiding principal is to keep simple .

sojharo commented 8 years ago

salaam,

In the following documentation for Android kiboengage client, I have defined what fields SDK is expecting from host application.

https://docs.google.com/document/d/1YoNpiPaKOLvEIsIK7OT81XKi1mZBZKk2FE6ZtARrqt8/edit#heading=h.pucqsw96kslc

This information is sent once when sdk is initlialized by host app. Afterwards, all the conversations which user does will use the same information.

Bulk SMS broadcast is regardless of this chart. It would be sent by agent only and user will just receive it. In the above chart, the user is initiating the support request.

sojharo commented 8 years ago

This document is on-going. I keep updating it on daily basis. As I code in kiboengage android client, I update this document for that part of code.

jekram commented 8 years ago

Good. So every time you update please let me know.

Now in regards to these fields:

Initialized the SDK

I agree these should be required filed:

appId clientId appSecret

Now for customer data, we should have the following:

Unique ID (This should be a required field that they must pass on, in it they can put email address, customer ID, phone number, account number. Each business would be different so can demand a Unique ID but we should not care about its content)

Besides Unique ID we should allow multiple optional fields, these would be self-defining fields, that we would pass to the agent for his information. The customer can pass x (let's start with 5) self-defining fields. Each will have a tag and a value:

Example: Email_ID, < > Customer_ID, < > Account_Number,< > Name, < > . . . Tele_Phone Number, < >

sojharo commented 8 years ago

From the above conversation, we would need to update the end to end documentation. I am adding the label 'update documentation' in this.

zarmeen92 commented 8 years ago

sir this change will required many modifications on server side code since on kiboengage server we require customer name and email address,customerid in

Alot of work will be required on kiboengage React side code to accomodate new changes For e.g: capture capture2

sumairasaeed commented 8 years ago

Worked on this. discussed with @zarmeen92 and @sojharo and implemented logic according to current flow of kibo engage on web. We can modify it when we make changes on web. Also I have updated the current flow in documentation. iOS was able to create chat session and it was also shown on web. Here is screenshot:

screen shot 2016-09-15 at 10 44 42 am
jekram commented 8 years ago

@sumairasaeed

I expect the status to be sent at the end of the work day. So I have time to review and give feedback.

Why this was sent at the end of the day?

jekram commented 8 years ago

I do not understand what was done here. I had given feedback to change the logic. So tell me what was implemented?

sumairasaeed commented 8 years ago

Made changes for getting data from host app. Some fields are set as required and others are optional as described in design document https://docs.google.com/document/d/1I6FajShS3mlV9HSoBU3HrDGmkHTYqkVAUNCv0Aa6oxk/edit#

Code is in progress for creating all sessions at start of application. It requires some more work and will be completed by today.

sumairasaeed commented 8 years ago

Worked more on this. When we open sample host appication, Single Chat session created and is shown on Kibo Engage Server: Here are screenshots:

1- When host application passed company name. Company name is shown in Session:

screen shot 2016-09-25 at 4 00 45 am

2- When Company name was not passed, it showed customerID(our unique required field):

screen shot 2016-09-25 at 4 01 25 am

The issue here is that it creates only single chat session. There were 2 Groups and 2 message channels so it should have created 4 chat sessions. I debugged by adding logs on client side. I found that session joining request is sent 4 times correctly by the client.

Next, I need to debug this with @zarmeen to understand better if this is client side issue or server side. I am marking it as "help wanted" . @zarmeen92 will run server in debugging mode so I can look into server side logs to confirm that all 4 requests were received by server in correct format or not. If requests were correctly received, then error is on server side. Else, error is on client side.

sumairasaeed commented 8 years ago

Me and @zarmeen worked together to debug this issue. We had discussion about current logic with @sojharo . Our current logic can create performance issues. It will eat up battery of mobile device and there will be load on server. For example: if there were 10 groups and and 10 message channels. So client will send 100 requests for creating sessions and server will receive 100 requests.

@sojharo has suggested to change our design logic. He suggested that we will have an endpoint on server which will receive information of new customer and will initialise all sessions for the customer.

@zarmeen will open required tasks on server side.

zarmeen92 commented 8 years ago

I have opened one task on kibosupport to initialize all the sessions for a customer at once https://github.com/Cloudkibo/KiboSupport/issues/351 and another task on kiboengage to display only sessions that are active https://github.com/Cloudkibo/KiboEngage/issues/154

jekram commented 8 years ago

Thanks @sumairasaeed @zarmeen92 for the update

sumairasaeed commented 8 years ago

Worked on this. Request IDs generated according to the format of server and stored in database for each message channel and group id. Created data object containing customer information and session info required to be sent to server. API call was not successful. it returned Failure. Debugged and found that session data of team id, channel id, and request id is going as null. values are not properly set. Next, Will work to correct it.

sumairasaeed commented 8 years ago

Corrected data to be sent in API call. API call still returns "failure" . @zarmeen92 just informed that there is some error in endpoint. she is debugging and working to correct server endpoint https://github.com/Cloudkibo/KiboSupport/issues/351. I will test it again when she's done.

sumairasaeed commented 8 years ago

Endpoint corrected. tested again. there is issue in parameters format of JSON being sent to server.server needs an array of objects. Data is not in correct format. Spent lot of time in debugging this. Also, work was very slow due to IBA internet issue. Here is screenshot of format sent to server: Next will again work to correct this format

screen shot 2016-09-29 at 5 30 32 pm
sumairasaeed commented 8 years ago

Further worked on fixing it. Data correctly sent in required JSON format now. Chat sessions are shown as created on web. But similar chat sessions are created multiple times instead of creating different channels. i rechecked the data sent. data of 4 different chat sessions were sent. Next step is to run kiboengage server in debug mode to see server side logs to understand it more why server has created similar sessions. FYI @zarmeen92 Here is screenshot of mobile chat sessions created:

screen shot 2016-10-02 at 11 15 58 am
jekram commented 8 years ago

I am not understanding this comment "But similar chat sessions are created multiple times instead of creating different channels" what is the definition of chat session and channels?

sumairasaeed commented 8 years ago

Sorry sir, typo error. Similar chat sessions are created multiple times instead of creating different sessions.

On Mon, Oct 3, 2016 at 3:41 AM, Cloudkibo notifications@github.com wrote:

I am not understanding this comment "But similar chat sessions are created multiple times instead of creating different channels" what is the definition of chat session and channels?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cloudkibo/Kibo_Client_iOS/issues/21#issuecomment-251001271, or mute the thread https://github.com/notifications/unsubscribe-auth/AKbhp9tePxVQRfVLEoFKTeNpMHU9IbHQks5qwDL-gaJpZM4J4ucb .

zarmeen92 commented 8 years ago

there was a bug in kibosupport Create Bulk sessions API.I have corrected the code. Now the sessions are initiated successfully capture1

sumairasaeed commented 8 years ago

This task has been done now. We can close this now