The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev guideRecipesAPI Reference
Dev guideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Webhooks for Agent

How to set up a webhook listener for Optimizely Agent.

Optimizely Agent implements a webhook listener used to receive inbound Webhook requests from optimizely.com. These webhooks enable PUSH-style notifications triggering immediate project configuration updates.

The webhook listener is configured on its own port (default: 8085), since it can be configured to select traffic from the internet.

To accept webhook requests Agent must be configured by mapping an Optimizely Feature Experimentation Project Id to a set of SDK keys along with the associated secret used for validating the inbound request. An example webhook configuration can be seen below, while the complete example configuration can be found in the provided config.yaml on GitHub.

##
## webhook service receives update notifications to your Optimizely Feature Experimentation 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 Feature Experimentation Projects to one or more SDK keys
    projects:
       ## <project-id>: Optimizely Feature Experimentation project id as an integer
        <project-id>:
            ## sdkKeys: a list of SDKs linked to this project
            sdkKeys:
                - <sdk-key-1>
                - <sdk-key-1>
            ## secret: webhook secret used the validate the notification
            secret: <secret-10000>
            ## skipSignatureCheck: override the signature check (not recommended for production)
            skipSignatureCheck: true

When running Agent in High Availability (HA) mode, it is important to ensure that all nodes are updated promptly when a webhook event (datafile updated) is received. By default, only one Agent node or instance will receive the webhook notification. A pub-sub system can be used to ensure this.

Redis, a powerful in-memory data structure store, can be used as a relay to propagate the datafile webhook event to the other nodes in the HA setup. This ensures that all nodes are notified about the event and can update their datafiles accordingly.

To set up Redis as a relay, you need to enable the datafile synchronization in your Optimizely Agent configuration. The PubSub feature of Redis is used to publish the webhook notifications to all subscribed Agent nodes.

Here is an example of how you can enable the datafile synchronization 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"