linagora / Twake

Twake is a secure open source collaboration platform to improve organizational productivity.
https://twake.app
GNU Affero General Public License v3.0
1.79k stars 195 forks source link

[Documentation] message delivery status endpoints for mobile team #2464

Open rezk2ll opened 2 years ago

rezk2ll commented 2 years ago

Mark message as delivered/acknowledged

acknowledge endpoint Used to set the message delivery status as `delivered` **URL** : `/notifications/v1/badges/:company_id/acknowledge` **Method** : `POST` **Auth required** : Yes **Data constraints** ```json { "channel_id": "string", "workspace_id": "string", "thread_id": "string", "message_id": "string" } ``` **Data example** ```json { "channel_id": "e5f7c7f2-049d-4a7b-8f8a-caa2502ec5b2", "workspace_id": "direct", "thread_id": "390e2680-27a1-11ed-aed4-d356d5444439", "message_id": "390e2680-27a1-11ed-aed4-d356d5444439" } ``` ## Success Response **Code** : `200 OK` **Content example** ```json true ``` ### or **Condition** : If the message is already marked as delivered and the status wasn't updated **Code** : `200 OK` **Content** : ```json false ``` ## Error Response **Condition** : Authorized User is not a member of the channel. **Code** : `403 FORBIDDEN` **Content** : `{}`

Mark message as seen

read endpoint Used to set the message delivery status as `seen` and updates the user read section for the specified channel **URL** : `/messages/v1/companies/:company_id/threads/read` **Method** : `POST` **Auth required** : Yes **Data constraints** ```json { "messages": [ { "thread_id": "string", "message_id": "string" } ], "channel_id": "string" } ``` **Data example** ```json { "messages": [ { "thread_id": "390e2680-27a1-11ed-aed4-d356d5444439", "message_id": "390e2680-27a1-11ed-aed4-d356d5444439" } ], "channel_id": "e5f7c7f2-049d-4a7b-8f8a-caa2502ec5b2" } ``` ## Success Response **Code** : `200 OK` **Content example** ```json true ``` ### or **Condition** : If the message is already marked as seen and the status wasn't updated **Code** : `200 OK` **Content** : ```json false ``` ## Error Response **Condition** : Authorized User is not a member of the channel. **Code** : `403 FORBIDDEN` **Content** : `{}`

Get user read sections for a channel

read sections endpoint Used to get the user read sections for the specified channel **URL** : `/channels/v1/companies/:company_id/workspaces/direct/channels/:channel_id/members/read_sections` **Method** : `GET` **Auth required** : Yes ## Success Response **Code** : `200 OK` **Response structure** ```json { "resources": [ { "channel_id": "string", "company_id": "string", "user_id": "string", "read_section": [ "start uuid", "end uuid" ] } ] } ``` **Content example** ```json { "resources": [ { "channel_id": "e5f7c7f2-049d-4a7b-8f8a-caa2502ec5b2", "company_id": "848a5f10-fe12-11ec-b347-75c7af22a5d1", "user_id": "39bc7fa0-1892-11ed-80d0-15129e1d52c4", "read_section": [ "5aa18f60-1e39-11ed-81b5-719ee3196dc6", "a1fe23a0-2799-11ed-abb6-b526528ffe9f" ] }, { "channel_id": "e5f7c7f2-049d-4a7b-8f8a-caa2502ec5b2", "company_id": "848a5f10-fe12-11ec-b347-75c7af22a5d1", "user_id": "83c44ff0-fe12-11ec-b347-75c7af22a5d1", "read_section": [ "b5fa3c70-1896-11ed-80d0-15129e1d52c4", "390e2680-27a1-11ed-aed4-d356d5444439" ] } ] } ``` ## Error Response **Condition** : Authorized User is not a member of the channel. **Code** : `403 FORBIDDEN` **Content** : `{}`