Before using the browser extension to send webhooks, you’ll need to complete some setup in FlexDeploy for confirming the webhook sender and defining what actions to trigger. Make sure to read our Incoming Webhooks pages first for a more detailed overview.
Webhook Provider
There will need to be at least one webhook provider for the browser extension. To provide a stronger level of security, a provider match script is used to verify a webhook is actually coming from your FlexDeploy browser extension before running any actions. The following match script example validates the webhook sender based on a token query parameter, the origin header, and the from URL attribute in the payload. You could also split the extension into multiple providers depending on the from URL, or skip checking this attribute.
def tokenQueryParam = QUERY_PARAMS.get('token'); def originHeader = HTTP_HEADERS.get('origin'); def fromURL = PAYLOAD.get('fromURL'); if (tokenQueryParam && originHeader && fromURL) { // TOKEN is an encrypted provider property // CHROME_EXTENSION_ID is a provider property. The origin header is sent in the form chrome-extension://<id> if (TOKEN.equals(tokenQueryParam) && CHROME_EXTENSION_ID.equals(originHeader) && fromURL.startsWith('http://apexhostname')) { LOG.fine('FlexDeploy Extension is a match'); return true; } } return false;
Webhook Functions
From here, there should be at least one webhook function configured to trigger actions in FlexDeploy based on the payload content. There are a variety of actions which can be performed, including building a project, creating a package, managing a release, committing to source control, and more. Check out the Webhook Function Samples and the FlexDeploy Methods pages for more ideas.