The webhook integration enables you to implement custom moderation by configuring an HTTP endpoint that Ably will invoke before messages are published to a chat room.
This integration is useful when you want to:
- Integrate with a custom moderation service hosted on your own infrastructure.
- Implement your own moderation logic using any web server or serverless platform.
- Use a moderation provider that isn't directly supported by Ably.
Integration setup
Configure the integration in your Ably dashboard or using the Control API.
The following fields are specific to the webhook transport. You can also configure the general fields.
| Field | Description |
|---|---|
| URL | The endpoint URL that Ably will send moderation requests to. |
| Headers | Optional HTTP headers to include with requests. Use this to provide authorization credentials or other required headers. |
Request and response
The webhook transport uses the standard request and response formats for custom moderation.
The HTTP status code is returned directly from your endpoint's response.
Best practice
When implementing your webhook endpoint, consider the following:
- Keep your endpoint response time as low as possible to minimize latency.
- Implement proper error handling and logging.
- Consider implementing rate limiting if you're using a third-party moderation service.
- Use HTTPS to encrypt data in transit.
- Authenticate requests using the headers field to prevent unauthorized access to your endpoint.
- Consider implementing caching for reoccurring content.
- Monitor the API request and integration error logs in the Ably dashboard to view errors from your integration.