How to Receive Notifications
Overview
To receive notifications, you need to configure a WebHook Notification Channel for your application. Notifications such as ImageGenerationProgress and ImageGenerationTaskCompleted will be sent to the configured endpoint.
Setting Up a WebHook Listener
Below is an example implementation of a WebHook listener to receive and parse notifications.
Example Listener (C#)
Notification Message Types
1. ImageGenerationTaskCompleted
Represents a notification sent when an image generation task is completed.
Sample JSON Structure
2. ImageGenerationProgress
Represents the progress of an image generation process.
Sample JSON Structure
Key Considerations
Endpoint Security:
Currently, no authentication mechanisms are supported for WebHook endpoints. Ensure your endpoint is secure.
Future updates will include authentication support.
Message Parsing:
Use a JSON parser compatible with your programming language to handle incoming messages.
Validate the message structure before processing.
Error Handling:
Return appropriate HTTP status codes (
400
,500
) for malformed requests or server-side issues.
Language-Agnostic Workflow
Setup WebHook Endpoint:
Create a POST endpoint to listen for incoming notifications.
Read Request Body:
Parse the incoming JSON payload to extract the notification message.
Identify Message Type:
Use the
MessageType
field to determine the notification type.
Process Message:
Handle each message type appropriately.
Last updated