Webhooks for Agent
How to configure a webhook listener for Optimizely Agent.
Optimizely Agent implements a webhook listener to receive webhook requests from optimizely.com. These webhooks enable PUSH-style notifications that trigger immediate project configuration updates.
The webhook listener is configured on its own port (default: 8089) because it may accept traffic from the internet.
To accept webhook requests, Agent must be configured by mapping a project ID to a set of SDK keys along with the secret used to validate requests. The following is an example configuration. See the complete config.yaml on GitHub:
##
## webhook service receives update notifications for your project. Receipt of the webhook will
## trigger an immediate download of the datafile from the CDN
##
webhook:
## HTTP listener port
port: "8089"
## a map of Optimizely projects to one or more SDK keys
projects:
## <project-id>: Optimizely project id as an integer
<project-id>:
## sdkKeys: a list of SDKs linked to this project
sdkKeys:
- <sdk-key-1>
- <sdk-key-2>
## secret: webhook secret used to validate the notification
secret: <secret-10000>
## skipSignatureCheck: override the signature check (not recommended for production)
skipSignatureCheck: trueWhen running Agent in High Availability (HA) mode, all nodes must be updated when a webhook event is received. By default, only one Agent node receives the webhook notification. You can use Redis as a pub-sub relay to propagate the event to all nodes in the HA configuration.
To configure Redis, enable datafile sync in your Agent configuration. Redis PubSub publishes webhook notifications to all subscribed Agent nodes.
The following is an example of how you can enable the datafile sync with Redis:
## synchronization should be enabled when features for multiple nodes like notification streaming are deployed
synchronization:
pubsub:
redis:
host: "localhost:6379"
password: ""
database: 0
## if datafile synchronization is enabled, then for each webhook API call
## the datafile will be sent to all available replicas to achieve better eventual consistency
datafile:
enable: true
default: "redis"Updated 1 day ago
