Skip to content

[NEW] Livechat: added room transfer endpoint to API#11453

Closed
hmagarotto wants to merge 6 commits intoRocketChat:developfrom
hmagarotto:livechat_api_room_transfer
Closed

[NEW] Livechat: added room transfer endpoint to API#11453
hmagarotto wants to merge 6 commits intoRocketChat:developfrom
hmagarotto:livechat_api_room_transfer

Conversation

@hmagarotto
Copy link
Copy Markdown
Contributor

Allow transfer a room to one agent using API.
With this feature we can transfer the visitor served by a bot to a human agent.

Post examples:

  • Transfer to user by ID:
curl ${headers} 'http://localhost:3000/api/v1/livechat/visitor/${visitorToken}/room/transfer' -d'{
"userId": "ID"
}'
  • Transfer to user by username:
curl ${headers} 'http://localhost:3000/api/v1/livechat/visitor/${visitorToken}/room/transfer' -d'{
"username": "username"
}'
  • Transfer to department by department ID:
curl ${headers} 'http://localhost:3000/api/v1/livechat/visitor/${visitorToken}/room/transfer' -d'{
"departmentId": "departmentId"
}'

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jul 13, 2018

CLA assistant check
All committers have signed the CLA.

return RocketChat.API.v1.unauthorized();
}

const rooms = RocketChat.models.Rooms.findOpenByVisitorToken(this.urlParams.visitorToken).fetch();
Copy link
Copy Markdown

@renatobecker-zz renatobecker-zz Jul 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this approach.. If you're transfering a Livechat Room to other agent, you need to know which room you want to transfer, don't you think? Otherwise, it looks like a random transfer.
I think that passing the roomId by parameter would be better.


return RocketChat.API.v1.success({
transfered: RocketChat.Livechat.transfer(room, visitor, {
userId: this.bodyParams.userId,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some concerns about passing userId by parameter and not using the logged-in user ( this.userId).

Copy link
Copy Markdown

@renatobecker-zz renatobecker-zz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question about the approach you're integrating your bot to Livechat.
We already have some bot's integrated into Livechat, such as Hubot, so a Hubot is a regular user, then the user is defined as a Livechat agent and can interact as a regular agent to Livechat visitors.

In your case, are you using the same approach I described above?

I'll be waiting for your feedback.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants