AmplicaLabs / social-app-template

Social Application Template that uses Gateway Services
Apache License 2.0
0 stars 2 forks source link

Implement Endpoint to Receive Content form Content Watcher #17

Closed enddynayn closed 2 months ago

enddynayn commented 2 months ago

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

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

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

Body:

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"
]
}
}
}
}
}
}