Webhook API for site integration (Flag message feature) #32

Closed
opened 2023-08-12 20:12:49 +00:00 by kirsle · 0 comments

There should be an easy way for users to report inappropriate messages on chat to the website. This could be done by defining Webhook APIs where BareRTC can call your website.

Config File

A [[Webhooks]] list could be used to define specific endpoint URLs on your website.

A randomly generated SharedSecret (customizable) will be an authentication token for your website, to authenticate that the request came only from your chat server.

Report Endpoint

Example JSON blobs that might be sent to a "report message" webhook.

{
    // Every webhook blob would have an 'action' in case you want to
    // just make one catch-all endpoint on your web application.
	"action": "report",
    
    // And contain the relevant object for that action
    "report": {
    	"fromUsername": "alice",
        "aboutUsername": "eve",
        "channel": "lobby",  // or @username for DMs
        "timestamp": "2023-01-01 14:35:00", // as seen on the front-end chat page of the reporter
        "createdAt": "2023-01-01 14:40:35", // server timestamp of this report
        "reason": "a user selectable reason for the report",
        "message": "what the reported user said in chat (raw HTML source code)",
    },
}

Chat UI

On the chat room, a red flag button could be added next to the emoji react picker on the bottom/right corner of the message. This better justifies just making the message box taller to avoid the current issue of text going underneath the emoji button on long messages.

Clicking it should open a Report Modal.

There should be an easy way for users to report inappropriate messages on chat to the website. This could be done by defining Webhook APIs where BareRTC can call your website. ### Config File A `[[Webhooks]]` list could be used to define specific endpoint URLs on your website. A randomly generated `SharedSecret` (customizable) will be an authentication token for your website, to authenticate that the request came only from your chat server. ## Report Endpoint Example JSON blobs that might be sent to a "report message" webhook. ```javascript { // Every webhook blob would have an 'action' in case you want to // just make one catch-all endpoint on your web application. "action": "report", // And contain the relevant object for that action "report": { "fromUsername": "alice", "aboutUsername": "eve", "channel": "lobby", // or @username for DMs "timestamp": "2023-01-01 14:35:00", // as seen on the front-end chat page of the reporter "createdAt": "2023-01-01 14:40:35", // server timestamp of this report "reason": "a user selectable reason for the report", "message": "what the reported user said in chat (raw HTML source code)", }, } ``` ### Chat UI On the chat room, a red flag button could be added next to the emoji react picker on the bottom/right corner of the message. This better justifies just making the message box taller to avoid the current issue of text going underneath the emoji button on long messages. Clicking it should open a Report Modal.
kirsle added the
enhancement
label 2023-08-12 20:12:49 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: apps/BareRTC#32
There is no content yet.