Open sourcing BeeChat Client And Developer Documentation

avatar

image.png

BeeChat is real-time chat service for Hive built by Hive-Engine. You probably have read the announcement post by @aggroed. If you have a Hive account, you can start chatting immediately with other users from the websites which would implement BeeChat in them.

Hive-Engine is open sourcing BeeChat client website which may help other developers to add chat feature in their website or mobile apps.

BeeChat Demo: https://beechat.hive-engine.com/
BeeChat Client: https://github.com/hive-engine/beechat-frontend

Client website is written in Vue JS, the logic for implementation on other frameworks should be similar. In future we will provide a embed-able chat widget code which will make it very easy to add the chat in any website.

BeeChat Developer Documentation

API

Base URL: https://beechat.hive-engine.com/api

GET /users/login

Logs in a user.

Query Parameters

  • username: String - Hive username, e.g. reazuliqbal
  • ts: Number - Timestamp in miliseconds, e.g. 1601355471900
  • sig: String - Signed username + timestamp using user's posting/active key. e.g. reazuliqbal1601355471900

Example Response

{
  "username": "reazuliqbal",
  "admin": true,
  "ws_token": "01EKC3JVR2D81AM8Z9S3Q0NVAJ"
}

GET /users/verify

Verifies if the current access token is valid. If the access token is not valid and there is a refresh token, then a new access token will be issued.

Query Parameters

No parameters are needed.

Example Response

{
  "username": "reazuliqbal",
  "ws_token": "01EKC3JVR2D81AM8Z9S3Q0NVAJ"
}

GET /users/refresh-token

Requests a new access token.

Query Parameters

No parameters are needed.

Example Response

{
  "username": "reazuliqbal",
  "ws_token": "01EKC3JVR2D81AM8Z9S3Q0NVAJ"
}

GET /users/friends

Returns user's friends and blocked list.

Query Parameters

No parameters are needed.

Example Response

{
    "friends": ["codebull", "bdcommunity", "aggroed"],
    "blocked": ["reazul-dev"]
}

GET /users/friend-requests

Returns an array of user's pending friend requests.

Query Parameters

No parameters are needed.

Example Response

[{
    "id": "01EKC46ZMG111C2HYABE80WE8T",
    "username": "reazul-dev"
}]

GET /users/settings

Returns user's settings.

Query Parameters

No parameters are needed.

Example Response

{
  "dm": {
    "only_from_friends": false
  }
}

POST /users/settings

Updates the user's settings.

Payload

  • dm - Object
    -- only_from_friends: Boolean

Example Response

{
  "dm": {
    "only_from_friends": false
  }
}

GET /users/channels

Returns an array of user-created channels.

Query Parameters

No parameters are needed.

Example Payload

[{
  "moderators": [],
  "members": ["reazuliqbal"],
  "blocked": false,
  "type": "channel",
  "name": "BDCommunity Chat",
  "creator": "reazuliqbal",
  "created_at": "2020-09-29T05:17:43.848Z",
  "updated_at": "2020-09-29T05:17:43.848Z",
  "id": "01EKC4Q317YM484Z7BMVG9Y1K0"
},
....
....
]

POST /users/channels

Creates a new channel.

Payload

  • name: String

Example Response

{
  "id": "01EKC4Q317YM484Z7BMVG9Y1K0",
  "name": "BDCommunity Chat",
  "creator": "reazuliqbal"
}

GET /users/logout

Logs out the user.

GET /messages/conversations

Returns an array of user's conversations.

Query Parameters

No parameters are needed.

Example Response

[{
  "moderators": [],
  "members": ["codebull", "reazuliqbal"],
  "blocked": false,
  "type": "dm",
  "creator": "reazuliqbal",
  "created_at": "2020-09-29T04:09:31.453Z",
  "updated_at": "2020-09-29T04:09:51.596Z",
  "id": "01EKC0T6HEVRDP0CYGZAE6VVFR"
},
.....
.....
]

GET /messages/conversation

Returns details of a conversation.

Query Parameters

  • id: String - ID of a conversation
  • ids: String - Comma separated IDs of conversations

Either id, or ids is required.

Example Response

{
  "moderators": [],
  "members": ["codebull", "reazuliqbal"],
  "blocked": false,
  "type": "dm",
  "creator": "reazuliqbal",
  "created_at": "2020-09-29T04:09:31.453Z",
  "updated_at": "2020-09-29T04:09:51.596Z",
  "id": "01EKC0T6HEVRDP0CYGZAE6VVFR"
}

GET /messages/new

Return an array of unread messages.

Query Parameters

No parameters are needed.

Example Response

[{
  "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR",
  "from": "codebull",
  "to": "reazuliqbal",
  "content": "Whats up?",
  "timestamp": "2020-09-29T05:31:56.399Z",
  "id": "01EKC5H3KFSWN7FE9XT497HGQT"
},
....
....
]

GET /messages/chats

Query Parameters

  • conversation_id: String. Required - Conversation ID
  • before: Number. Optional - Timestamp from which to return messages
  • limit: Number. Optional - Number of messages to return

Example Response

[{
  "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR",
  "from": "reazuliqbal",
  "to": "codebull",
  "content": "Hey, first message from BeeChat",
  "timestamp": "2020-09-29T04:09:31.473Z",
  "id": "01EKC0T6JHCGEPGPSMRB3X88RR",
  "read": true
}, {
  "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR",
  "from": "codebull",
  "to": "reazuliqbal",
  "content": "Hey Hey!",
  "timestamp": "2020-09-29T04:09:51.617Z",
  "id": "01EKC0TT81T2WGRKKYPQRXWGVA",
  "read": true
},
....
....
]

WebSocket

Server: wss://ws.beechat.hive-engine.com

A WebSocket server is for two way communication between a server and a user, this facilitates the real-time chatting. As soon as a user connects to the WebSocket server, they should authenticate themselves otherwise the connection will be closed by the server.

The server will only accept JSON message and will also reply in JSON.

Protocol

{
  "type": String,
  "payload": Object
}

Authentication

Authenticate the user with the server.

Message

{
  "type": "authenticate",
  "payload": {}
}

Response

{
  "type": "status",
  "payload": {
    "authenticated": true
  }
}

authenticated could be true or false depending on the user's authentication status.

Create Conversation

Creates a DM or group conversation.

Payload

  • to: String (dm) or Array (group)
  • message: String

Message

// DM
{
  "type": "create-conversation",
  "payload": {
    "to": "reazuliqbal",
    "message": "Hi"
  }
}

// GROUP
{
  "type": "create-conversation",
  "payload": {
    "to": ["codebull", "reazul-dev"],
    "message": "This is a group conversation!"
  }
}

Response

The server will respond with two messages. One for the created conversation and one for the new chat message.

{
  "type": "conversation-created",
  "payload": {
    "moderators": [],
    "members": ["codebull", "reazul-dev", "reazuliqbal"],
    "blocked": false,
    "type": "group",
    "creator": "reazuliqbal",
    "created_at": "2020-09-29T06:16:25.695Z",
    "updated_at": "2020-09-29T06:16:25.695Z",
    "id": "01EKC82JAMV9JQ1PPG9CNDF3ER"
  }
}
{"type":"chat-message","payload":{"id":"01EKC82JBDQD25B94NZRSH2FMX","conversation_id":"01EKC82JAMV9JQ1PPG9CNDF3ER","content":"This is a group conversation!","from":"reazuliqbal","to":null,"read":false,"timestamp":"2020-09-29T06:16:25.709Z"}}

Rename Conversation

Renames a group conversation. Only the creator can rename a conversation.

Payload

  • conversation_id: String - ID of the conversation to be renamed.
  • name: String - New name

Message

{
  "type": "rename-conversation",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "name": "The Awesome Group"
  }
}

Response

{
  "type": "conversation-renamed",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "name": "The Awesome Group"
  }
}

Leave Conversation

Leaves a conversation.

Payload

  • conversation_id: String - ID of the conversation.

Message

{
  "type": "leave-conversation",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER"
  }
}

Response

To user:

{
  "type": "conversation-removed",
  "payload": {
    "id": "01EKC82JAMV9JQ1PPG9CNDF3ER"
  }
}

To all members:

{
  "type": "member-left",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "member": "codebull"
  }
}

Chat Message

Send a new chat message.

Payload

  • conversation_id: String - ID of the conversation.
  • to : String (dm) or null (group) - Username of the recipient or null
  • message: String - Message to be sent to the chat

Message

// DM
{
  "type": "chat-message",
  "payload": {
    "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR",
    "to": "reazuliqbal",
    "message": "Hey"
  }
}
// GROUP
{
  "type": "chat-message",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "to": null,
    "message": "Hey!"
  }
}

Response

{
  "type": "chat-message",
  "payload": {
    "id": "01EKCA9BWCJXQEPMVF047QQFXW",
    "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR",
    "content": "Hey",
    "from": "codebull",
    "to": "reazuliqbal",
    "read": false,
    "timestamp": "2020-09-29T06:55:05.613Z"
  }
}

Delete Message

Deletes a message from chat. The sender can delete a message. Creator and Moderators can delete any message from a group chat.

Payload

  • id: String - ID of the message

Message

{
  "type": "delete-message",
  "payload": {
    "id": "01EKCAE9KSKTQ7SHX0P0PZZ53Z"
  }
}

Response

{
  "type": "message-deleted",
  "payload": {
    "id": "01EKCAE9KSKTQ7SHX0P0PZZ53Z"
  }
}

Acknowledgment

Sets a conversation as read.

Payload

  • conversation_id: String - ID of the conversation

Message

{
  "type": "acknowledgment",
  "payload": {
    "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR"
  }
}

Response

{
  "type": "acknowledged",
  "payload": {
    "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR"
  }
}

Add Member

Adds a new member to a group conversation. Creator and Moderators can add a new member.

Payload

  • conversation_id: String - ID of the conversation to be renamed.
  • username: String - New member's Hive username

Message

{
  "type": "add-member",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "username": "bdcommunity"
  }
}

Response

{
  "type": "member-added",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "username": "bdcommunity"
  }
}

Remove Member

Removes a member from a group conversation. Creator and Moderators can remove a member.

Payload

  • conversation_id: String - ID of the conversation to be renamed.
  • username: String - Hive username of the member to be removed.

Message

{
  "type": "remove-member",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "username": "bdcommunity"
  }
}

Response

{
  "type": "member-removed",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "username": "bdcommunity"
  }
}

Add Moderator

Adds a new moderator for a group conversation.

Payload

  • conversation_id: String - ID of the conversation.
  • username: String - Hive username of the member.

Message

{
  "type": "add-moderator",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "username": "reazul-dev"
  }
}

Response

{
  "type": "moderator-added",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "username": "reazul-dev"
  }
}

Remove Moderator

Removes a moderator. Only the Creator can remove a moderator.

Payload

  • conversation_id: String - ID of the conversation.
  • username: String - Hive username of the member.

Message

{
  "type": "remove-moderator",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "username": "reazul-dev"
  }
}

Response

{
  "type": "moderator-removed",
  "payload": {
    "conversation_id": "01EKC82JAMV9JQ1PPG9CNDF3ER",
    "username": "reazul-dev"
  }
}

Request Friendship

Sends a friend request.

Payload

  • username: String - Hive username

Message

{
  "type": "request-friendship",
  "payload": {
    "username": "reazuliqbal"
  }
}

Response

{
  "type": "friendship-requested",
  "payload": {
    "id": "01EKCB8D4PVDHBQ4MC7T4JFYAB",
    "username": "reazul-dev"
  }
}

Accept Friendship

Accepts a friend request.

Payload

  • id: String - ID of the friend request

Message

{
  "type": "accept-friendship",
  "payload": {
    "id": "01EKCB8D4PVDHBQ4MC7T4JFYAB"
  }
}

Response

{
  "type": "friendship-accepted",
  "payload": {
    "id": "01EKCB8D4PVDHBQ4MC7T4JFYAB",
    "username": "reazul-dev"
  }
}

Reject Friendship

Rejects a friend request.

Payload

  • id: String - ID of the friend request

Message

{
  "type": "reject-friendship",
  "payload": {
    "id": "01EKCBKXX88MANDK8FWNQAG8AB"
  }
}

Response

{
  "type": "friendship-rejected",
  "payload": {
    "id": "01EKCBKXX88MANDK8FWNQAG8AB"
  }
}

Remove Friendship

Removes a friend.

Payload

  • username: String - Hive username

Message

{
  "type": "remove-friendship",
  "payload": {
    "username": "reazul-dev"
  }
}

Response

{
  "type": "friendship-removed",
  "payload": {
    "username": "reazul-dev"
  }
}

Block User

Blocks a user, blocking a user will remove them from the friend list.

Payload

  • username: String - Hive username

Message

{
  "type": "block-user",
  "payload": {
    "username": "codebull"
  }
}

Response

{
  "type": "user-blocked",
  "payload": {
    "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR",
    "username": "codebull"
  }
}

Unblock User

Unblocks a user.

Payload

  • username: String - Hive username

Message

{
  "type": "unblock-user",
  "payload": {
    "username": "codebull"
  }
}

Response

{
  "type": "user-unblocked",
  "payload": {
    "username": "codebull",
    "conversation_id": "01EKC0T6HEVRDP0CYGZAE6VVFR"
  }
}

Re-authentication Required

Server will send reauthentication-required message 1 minute before authentication is about to expire. Do listen to those messages for renewing authentication by requesting a new access token from the /users/refresh-token API endpoint.

Response

{
  "type": "reauthentication-required",
  "payload": {
    "username": "codebull"
  }
}

Please note that this service is in Beta. If you find any bug, please report them to me @reazuliqbal (reazuliqbal#1149). If you need any help in implementing this chat, feel free to contact me on Discord.



I am running a Hive Witness as @BDCommunity.

Please vote for @BDCommunity as a witness.



0
0
0.000
47 comments
avatar

So well documented, really appreciated. A chat option was one of the few missing pieces of a wholesome communication platform. Curiously following the developments.

0
0
0.000
avatar

More features to come. Thank you for your comment.

0
0
0.000
avatar

Good work, Will you opensource backend as well?

0
0
0.000
avatar

Thanks. For the backend we haven't decided yet.

0
0
0.000
avatar

there is DISCORD, nobody needs a HIVE Chat :D

0
0
0.000
avatar

Discord is super useful, but unfortunately can't be used on websites yet or logged in with hive credentials.

BeeChat is useful where hive users need to communicate on the website they are using without going to a separate app or website. For example the Alpha version of BeeChat is running on https://nftshowroom.com/ to enable quick chat between an artist and a collector.

0
0
0.000
avatar

i think discord is much better

0
0
0.000
avatar

It's different... "is useful where hive users need to communicate on the website they are using without going to a separate app or website. For example the Alpha version of BeeChat is running on https://nftshowroom.com/ to enable quick chat between an artist and a collector"
A slow computer would probably be very happy. :)

0
0
0.000
avatar

Noice, We proud of you Rea 😂

0
0
0.000
avatar

Great development. I don't know much about coding and the technicals, but will it cost Ressource Credits in order to sent message over BeeChat. Are there any costs related to that service?
And I'm also curious what other kind features this tool might bring in the future? Emojis, stickers, nfts, Hive Engine Tokens....probably???
Exciting times, thanks for your great work!

0
0
0.000
avatar

No it won't cost you RC, there is also no monetary cost to use the service.

0
0
0.000
avatar
(Edited)

What about in reverse?
Give a small amount of reward for people to use the service which undoubtedly would gain you uptake.

Personally I think this is too little too late. Steemit needed this before communities or with the launch of communities. So many have left since those days and I would imagine 'lack of social engagement' is high on reasons why.

So if I was a developer here I would most definitely be creating an incentive for people that contribute to engagement to be rewarded incrementally. I would actually be further developing it as a 'mobile Blockchain portal' to Hive and to the world of Blockchain in general. To cater not just to the audience of Hive but the many that do all their chat on discord and other chat clients outside of Blockchains but are essentially 'Blockchain People'. That's a niche which would definitely find a 'crypto chat client' enticing and something that would give Hive and devs on this Blockchain clout.

That's what is missing in this so called "web 3.0" .. ACTUAL SOCIAL tools and engagement. That's why mainstream doesn't care much for what is provided here. When people start to take this seriously and develop for that audience, then, AND ONLY THEN will you get user growth.

0
0
0.000
avatar

At its core BeeChat is not a user facing service, it is built to help other Hive developers and service administrators to integrate a communication feature in their apps if there is a need.

For example, in NFT Showroom and similar Hive based websites we are building, we needed a simple chat service where buyers and sellers can communicate without hopping into another app, so we have decided to decouple the chat module and release it for everyone other websites we might need this.

0
0
0.000
avatar

Yeah I see. So it's not able to exist outside of the Hive system?

That's crazy that it wasn't until NFTshowroom came into existence that developers got that light bulb thought "we need chat." I remember when I joined steemit and realized that to chat to people one needed another service to do it outside of the system so I automatically concluded that blockchain was nowhere near a product ready for market. 3 years on, that assessment hasn't really changed.

I'm not critiquing you personally but what I find foolish here is that people want to onboard masses (hoping token price will benefit) but don't at all want to discuss that the product is too basic. Expecting people to leave the "evil mainstream platforms" without actually having a better service is just never going to be a reality.

0
0
0.000
avatar

Great Job. Hope this helps to attract more users to Hive. Proud of you, Panda

0
0
0.000
avatar

Would you be willing to implement a method for sending out of band data so that things required for end to end encryption, such as key exchanges, are easier to implement on top of BeeChat?

0
0
0.000
avatar

I am not very clear on the end-to-end encryption, so can't comment on that.

0
0
0.000
avatar

Congratulations @reazuliqbal! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

Your post got the highest payout of the day

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @hivebuzz:

Hive Power Up Day - Introducing the Power Up Helper!
Hive Power Up Day - Let's grow together!
0
0
0.000
avatar

I mistakingly sold my Gold Lightning Dragon for 3.199$. It was meant to be 3199$. Are you here? Would you kindly return it, I'll return you your 3.199 and more if you wish. It was a dumb mistake, I don't know how it happened.

0
0
0.000
avatar

Hello @reazuliqbal ... I do not know how else to contact you. so I am writing you about my POB token that I sold today at Hive-engine, the proceeds of which were transferred to my Hive account @mers... Can you please check on my transaction ID. "b4401600bb2235aab21f92fc1c28bff4563923c0" ? Until now, I haven´t gotten my hive transferred to my account. Kindly check because your name was listed below under BD Community in this transaction. Thank you. @mers

action:"withdraw"
blockNumber:9083795
contract:"hivepegged"
databaseHash:"9c9e912657fdb4667b4d9195d815f512769b8eb40b3d2b2a58ba5fc56f884952"

0
0
0.000
avatar

please consider reviewing your witness votes

image.png

0
0
0.000
avatar

I withdraw but three hours not come hive keychain

0
0
0.000
avatar

Hi @reazuliqbal, would you have any problem if I fork your old Steem Escrow project and try and update it for Hive?

0
0
0.000
avatar

Maybe this should be taken care of on discord @reazuliqbal but can you take a look at the proofofbrain.io NFT market?
https://www.proofofbrain.io/nfts/

I look at the history of transactions and find that the buyer sends money but the artist never receives the money paid.

You can see a trade made today and the artist didn't receive payment.

https://he.dtools.dev/@jaxsonmurph?symbol=POB

Thanks for your attention^^

0
0
0.000
avatar

I am not aware of any problem. https://he.dtools.dev/@jaxsonmurph?symbol=POB website doesn't list complete NFT actions. Do not relay on it for the tracking, check the transaction history on the POB website.

0
0
0.000
avatar
(Edited)

Here I see a transfer but I don't see the POB added to his POB wallet:

https://he.dtools.dev/tx/49decb0490a47002034bf5a31a2e9cdf52e56d9b

image.png

There should be some notification in his wallet but there is nothing there:

https://www.proofofbrain.io/@jaxsonmurph/wallet

There should also be a notification of something in nft.pob's wallet but there is nothing there

https://www.proofofbrain.io/@nft.pob/wallet

Artists like to see some notification when they are paid.

0
0
0.000
avatar

Please look at the pob transactions in the above comment @reazuliqbal for there is no notification if pob was added to the wallet on the front end.

0
0
0.000
avatar

Gracias 😁 por VISITAR nuestro blog y también gracias por tu voto 😊

0
0
0.000
avatar

Gracias por tu apoyo
te sigo, VOTO y !PIZZA 😎

0
0
0.000
avatar

Hi @reazuliqbal, I just wanted to touch base with you to ask for a witness vote, I am a new witness, I own my hardware, hosted here in Adelaide, I have supported your witness for some time also

0
0
0.000