To connect two different applications, you can use webhooks. By using webhooks, you can set up event notifications.

A webhook is an HTTP callback. When an event happens, a web application implementing webhooks broadcasts data about that event and sends it to a webhook URL from the application that you want to receive the information. For more information, see the Cloud Developer Platform.

In the context of VMware Cloud Director, you can configure webhooks by using webhook behaviors. Webhook behaviors send out a POST request to a remote webhook server. The body of the request contains information about the behavior invocation and the entity the behavior was invoked on. You can also customize the body by using a template. The webhook server response determines the result of the behavior invocation task. There are three different types of responses that the server can return.

The remote webhook server can be any server that VMware Cloud Director can reach. However, before creating a webhook behavior, you must verify that the endpoint of the webhook is secure.

  • Verify that the webhook endpoint is an HTTPS endpoint.
  • Verify that the organization of the user invoking the behavior trusts the webhook server certificate. This means that even if the certificate is present in a VMware Cloud Director trust store, if the organization of the user, who invokes the behavior does not trust the certificate, the webhook behavior will not run.
  • You can add a certificate to the trust store by using the UI or the VMware Cloud Director API. See Managing Certificates Using Your VMware Cloud Director.

Creating Webhook Behaviors

"POST https"://host/cloudapi/1.0.0/interfaces/<interface_id>/behaviors{
Field Desciption
type Required field. Must be WebHook.
id Optional string field.
href Required field for the URL that must receive requests from VMware Cloud Director.
_internal_key Required field for the shared secret used for signing the requests sent to the webhook endpoint.
invocation_timeout Optional field specifying the timeout in seconds for the response from the webhook server
template.content Optional field for customization of the payload sent to the webhook server. You can provide a template as a string. You can add other fields to execution_properties, accessible to the template.
_secure_ Fields with prefix _secure_ are optional. The fields are write-only and cannot be obtained through a GET request on the behavior. The field value gets encrypted before it is saved to the VMware Cloud Director database. The fields are accessible to the template.

Payload From VMware Cloud Director to the Webhook Server

There is a default format of the payload sent to the webhook server. You can also customize the payload by using a template.

Default payload example:

For custom payloads with a template, you can specify a template for the payload sent to the webhook server. If you do not specify a template, VMware Cloud Director sends the default request payload to the webhook server. The Apache FreeMarker template engine renders the payload from the provided template and the data model.

The data model represents all the data prepared for the template, in other words, all the data that you can include in the payload. The data model contains the invocation arguments of the webhook behavior, for example, arguments, metadata, execution properties, and entity information. The following example shows the tree-like structure of the data model.
+ - entityId 
+ - typeId 
+ - arguments
+ - arguments_string 
+ - _execution_properties 
+ - _metadata
|   |
|   + - executionId
|   + - behaviorId
|   + - executionType
|   + - taskId
|   + - execution 
|   |   |
|   |   + - href
|   + - invocation 
|   + - invocationId
|   + - requestId
|   + - apiVersion
+ - entity 
+ - entity_string
Table 1. Invocation arguments
Argument Description
entityId ID of the invoked defined entity.
typeId ID of the entity type of the invoked defined entity.
arguments The arguments passed in the behavior invocation.
arguments_string A JSON format string of arguments. You can use it if you want to add all the arguments to the payload.
_execution_properties You can select all the values from the execution_properties invocation argument by key name.
execution You can select all the values from the execution invocation argument by key name.
invocation You can select all the values from the invocation argument by key name.
entity A map of the entity content. You can select all values in the entity by key name.
entity_string A JSON format string of entity.

For more information on the Apache FreeMarker expression language for the template for the payload, see

Sample template:
<#assign header_Content\-Type= "application/json" />
"text": "Behavior with id ${_metadata.behaviorId} was executed on entity with id ${entityId}"   
You can specify custom headers that you want to add to the POST request sent to the webhook servers. You can use the webhook template for adding custom headers which are variables in the template with the prefix header_. For example, you can specify the value for the Authorization header by adding the following line to the template:
<#assign header_Authorization = "${_execution_properties._secure_token}" />

Payload From the Webhook Server to VMware Cloud Director

  • Default response
    The default payload from the webhook server to VMware Cloud Director must contain the following.
    • The response can either have no Content-Type header or a Content-Type header with text/plain value.
    • The response body must be a string.
    • The body of the response is used as the result of the behavior invocation. The status for the behavior invocation task is success. The task result is set to the body of the response.
  • Single task update response
    Apart from the behavior result, the task update response can set some other behavior invocation task properties like status, details, operation, error, progress, and result. Because this is a one-time task update, the response must complete the task. If the response does not set the task status to success, error, or aborted, then the task fails with an error. The error message indicates that the status was not acceptable.
    • The response must have a Content-Type header with application/vnd.vmware.vcloud.task+json value.
    • The response body must contain a JSON representation of the TaskType class containing the task properties you want to modify.
    • Sample response body with status success:
         "details":"example details",
         "operation":"example operation",
            "resultContent":"example result"
    • Sample response body with status error:
         "details":"example details",
         "operation":"example operation",
            "message":"example error message"
  • Continuous task update response
    The webhook server can send multiple task updates by using a multi-part HTTP response. Each update is a separate body part of the response body. The last body part of the webhook server response body must finish the task. If the response body does not finish the task, the task fails with an error.
    • The response must have a Content-Type header with multipart/form-data; boundary=... value.
    • The response body must start and end with a boundary string --<boundary_string>. Each part of the response body must end in a boundary string. You must specify the boundary in the Content-Type header of the HTTP response from the webhook server.
      Content-Type: multipart/form-data; boundary=<boundary_string>
      Content-Type: application/vnd.vmware.vcloud.task+json
      "details": "example details",                      
      "operation": "example operation",
      "progress": 50
      Content-Type: application/vnd.vmware.vcloud.task+json
      "status": "success",
      "progress": 100,
      "result": {
      "resultContent": "example result"

    The body parts in the response body must be in the format for a task update or the format for a final update.

    Task update example:
    Content-Type: application/vnd.vmware.vcloud.task+json
    "details": "example details",
    "operation": "example operation",
    "progress": 50
    Final update example:
    Content-Type: text/plain

Authentication of the Webhook Behavior Requests

Hash-based message authentication code (HMAC) authentication secures webhook behavior requests. HMAC is a mechanism ensuring the authenticity and integrity of HTTP requests. To ensure the authenticity and integrity, HMAC includes two custom headers to each HTTP request. The custom headers are a signature header and a digest. For VMware Cloud Director, the signature header is x-vcloud-signature and the digest is x-vcloud-digest.

The signature header x-vcloud-signature is a custom header sent with each webhook request. The signature header consists of an HMACSHA512 algorithm, headers, and a VMware Cloud Director generated signature. The headers show what is in the base string which is signed to create the signature.
Table 2. Header Fields
Field Description
host The webhook server host
date Date of the request
(request-target) Linked lowercase HTTP method, ASCII space, and request path headers. For example, post /webhook.
digest SHA-512 digest of the request body

To generate the signature header, you need a shared secret. The shared secret is a string that only VMware Cloud Director and the webhook server know.

The digest header x-vcloud-digest is a Base64-encoded SHA-512 digest of the request body.

Each webhook request from VMware Cloud Director can be verified by generating the signature using the shared secret and comparing it to the signature in the signature header from VMware Cloud Director.

Invoking Webhook Behaviors

You can invoke webhook behaviors like any other behavior.
"arguments": {
"argument1": "data1",
"argument2": "data2",