Document toolboxDocument toolbox

Configuring Webhook Services

A webhook integration allows you to send Infoblox Platform notifications to a designated application by using a unique URL. When setting up a webhook service, you can choose to use the default webhook template or construct a custom template for a specific payload for your webhook notification. 

To ensure that notifications associated with an existing custom webhook service function properly when you modify the service configuration, you must first disable the notifications associated with the service. After you are done with the changes, you can enable the notifications again. For information, see the Modifying Custom Webhook Services section in this topic.

Creating New Webhook Services

To set up a new webhook service, do the following:

  1. Log in to Infoblox Portal.
  2. Click the notification icon on the top right corner of the Portal (next to the global search icon).
  3. In the Notifications panel, click the ellipse icon > View All/Settings.
  4. Click the Service Integrations tab.
  5. Click Add Service Integration and specify the following:
  • Type: From the drop-down menu, select Custom to set up a webhook integration.
  • Name: Enter the name of the webhook service. Infoblox Platform uses this name on the Notification Settings page, for configuration purposes. For more information, see Configuring Notification Settings.
  • URL: Enter the URL of the application to which you want Infoblox Platform to send notifications. Email notifications in a standardized JSON format are sent to this URL.
  • Authentication: From the drop-down menu, choose the authentication method for this webhook integration:
    • None: No authentication is required for this integration.
    • Basic: Enter the username and password for basic authentication.
    • Token: Enter the access token to be used for authentication.  
  • Template: A template determines the output of your webhook notification. You can create a custom webhook template in the editor provided here.  Infoblox Platform supports the Go template format: a standard template used to generate textual output. For information about Go templates, see https://pkg.go.dev/text/template. If you do not provide a custom template, Infoblox Platform generates the payload according to the supported fields in the default template. For more information, see Default Webhook Template and Supported Keys.

  • Webhook Context: Note the following when creating a custom webhook template.
  • You can include actions in your template by specifying user-defined key-value pairs in Webhook Context. When generating the payload, Infoblox Platform uses the keys and values you define.
  • If you compose a valid template but have not defined any key-value pairs in Webhook Context, then Infoblox Platform obtains the values from the database, if the values exist. For the keys that do not have values, only the key names with empty values will appear in the payload.
  • If you compose a valid template but do not include certain keys you have defined in Webhook Context, Infoblox Platform ignores those key-value pairs, so they will not appear in the payload.
  • If your custom template includes supported keys from the default template, and if you have defined key-value pairs for them in Webhook Context, the user-defined values will override the default values, if applicable.

The following is an example of a simple Go template: 

Customer: {{ .customer_name}} 
Application: {{ .application_name}} 
Message: {{ .message}}

You define values for customer_name and application_name in the Webhook Context field. Note that Message is an Infoblox-defined field.

The following is an example of how to use the actionable_redirect_action and actionable_redirect_label keys:

{{if $url:=.actionable_redirect_action}}
ActionableRedirectUrl: {{$url}}
{{if $text:=.actionable_redirect_label}}
ActionableRedirectText: {{$text}}
{{else}}ActionableRedirectText: {{$url}}  {{end}}
{{end}}

For more information about the default template and supported keys, see Default Webhook Template and Supported Keys.

You can also use the Infoblox API to create a custom template. For more information about using the notification APIs, see Infoblox Platform > Notifications config in 
https://csp.infoblox.com/apidoc.

  • Webhook Context: In the JSON editor, specify key-value pairs for the actions in your webhook template. You can also specify HTTP header overrides used to generate the webhook notification.

Based on the template example above, you might define the following key-value pairs:


{

    "customer_name": “John Doe”,

    "application_name": "Universal DDI",

    "Authorization": ["Basic YWxhZGRpbjpvcGVuc2VzYW1l", "http-header:true"],

    "Content-type": ["application/xml", "http-header:true "]

	“actionable_redirect_action”: “https://actionable.redirect.url.com”,

	“actionable_redirect_label”: “actionable redirect link text”

}

Note that the actionable_redirect_label key is optional. If it is missing, the default value would be the value in actionable_redirect_action. In addition, if actionable_redirect_action is missing, neither ActionableRedirectUrl nor ActionableRedirectText will show up in the HTTP payload.

The webhook context must be in a valid, non-nested JSON format.

Based on the examples given in the Template and Webhook Context fields, Infoblox Platform generates the following:

 HTTP headers:

"Authorization": ["Basic YWxhZGRpbjpvcGVuc2VzYW1l"]    

"Content-type": ["application/xml"]

HTTP payload:

Customer:  John Doe,

Application:  Universal DDI

Message:  Internal error occurred. For more details, see log for request 1a94821f-0f7a-48ab-b1cf-b137d628afd4

ActionableRedirectUrl: https://actionable.redirect.url.com

ActionableRedirectText: actionable redirect link text

Click Validate after you complete the template and webhook context. Infoblox Platform validates the JSON schema you have entered and sends an error if the template or webhook context is not in a valid JSON format.

Click Save & Close.

Note

After you have added or configured new services, they will appear in the Service Integrations section of the Notifications page. Ensure that you select the new services if you want to send notifications to them. For information on how to configure notification settings, see Configuring Notification Settings.

Modifying Existing Webhook Services

If you need to modify an existing webhook service, you must first disable all notifications associated with the service. You can then make changes to the webhook service before enabling notifications again.

To modifying an existing webhook service, do the following:

  1. Log in to Infoblox Portal.
  2. Click the notification icon on the top right corner of the Portal (next to the global search icon).
  3. n the Notifications panel, click the ellipse icon > View All/Settings
  4. Click Admin Settings on the upper right-hand corner of the page.
  5. In the Admin Settings dialog, expand the Service Integrations section.
  6. Deselect all the notification check boxes for the respective webhook service to which you plan to make changes.
  7. Click Save & Close.
  8. Go to the Notifications > Service Integrations tab.
  9. Click Edit on the webhook service you want to modify.
  10. In the edit dialog, make the required changes, and then click Save & Close. See the Creating New Webhook Services section for more information.
  11. Click Admin Settings on the upper right-hand corner of the page again.
  12. In the Admin Settings dialog, expand the Service Integrations section.
  13. Select the check boxes of the notifications that you want to enable for the modified webhook service.
  14. Click Save & Close.