Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Implement Endpoint to Receive Content form Content Watcher #12

@enddynayn

Description

@enddynayn

Description
Add endpoint to receive content from Content Watcher Service. Content Watcher Service allows to register a webhook that it calls when a new event is produced and sends the contents of those events.

Acceptance Criteria

  • Implement a Post endpoint /v2/webhook/broadcast to receive message.
  • Ensure messages are stored for retrieval

Technical Specs:
Endpoint URL: POST /v2/webhooks/broadcast

Purpose: To receive and process broadcast messages from the Content Watcher Service.

Body:

  • schemaId (integer): Identifier for the schema version.
  • announcement (object): Contains the details of the broadcast message, including:
    -- fromId (string): The identifier of the sender.
    -- contentHash (string): Hash of the content being broadcasted.
    -- url (string): URL where the broadcasted content can be accessed.
    -- announcementType (integer): The type of announcement being made.
    All properties within the announcement object are required for a valid request.

Expected Responses:

201 Created: Indicates that the broadcast message was successfully received and processed.
Error Responses: Implement appropriate error responses for various scenarios, such as 400 Bad Request for invalid payloads, 401 Unauthorized for unauthenticated requests, and other relevant HTTP status codes for error states encountered by the endpoint.
Security Measures: Implement verification mechanisms to authenticate the source of the webhook calls.

References
Image

Open API Spec

{
  "/v2/webhooks/broadcast": {
    "post": {
      "operationId": "postBroadcastWebhook",
      "summary": "Webhook for new broadcasts",
      "requestBody": {
        "required": true,
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/BroadCastMessage"
            }
          }
        }
      },
      "responses": {
        "201": {
          "description": "Successful response"
        }
      }
    }
  }
}
{
"content": {
    "schemas": {
      "BroadCastMessage": {
        "type": "object",
        "properties": {
          "schemaId": {
            "type": "integer"
          },
          "announcement": {
            "type": "object",
            "properties": {
              "fromId": {
                "type": "string"
              },
              "contentHash": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "announcementType": {
                "type": "integer"
              }
            },
            "required": [
              "fromId",
              "contentHash",
              "url",
              "announcementType"
            ]
          }
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions