# Webhook

- [YAML representation](https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#SCHEMA_REPRESENTATION)
- [Handler](https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#Handler)
  - [YAML representation](https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#Handler.SCHEMA_REPRESENTATION)
- [HttpsEndpoint](https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#HttpsEndpoint)
  - [YAML representation](https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#HttpsEndpoint.SCHEMA_REPRESENTATION)
- [InlineCloudFunction](https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#InlineCloudFunction)
  - [YAML representation](https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#InlineCloudFunction.SCHEMA_REPRESENTATION)

Metadata for different types of webhooks. If you're using `inlineCloudFunction`, your source code must be in a directory with the same name as the value for the `executeFunction` key. For example, a value of `my_webhook` for the`executeFunction` key would have a code structure like this: - `/webhooks/my_webhook.yaml` - `/webhooks/my_webhook/index.js` - `/webhooks/my_webhook/package.json`

| YAML representation ||
|---|---|
| ``` handlers: - object (`https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#Handler`) # Union field `webhook_type` can be only one of the following: httpsEndpoint: object (`https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#HttpsEndpoint`) inlineCloudFunction: object (`https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#InlineCloudFunction`) # End of list of possible types for union field `webhook_type`. ``` |

| Fields ||
|---|---|---|
| `handlers[]` | ``object (`https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#Handler`)`` List of handlers for this webhook. |
| Union field `webhook_type`. Only one webhook type is supported. `webhook_type` can be only one of the following: |||
| `httpsEndpoint` | ``object (`https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#HttpsEndpoint`)`` Custom webhook HTTPS endpoint. |
| `inlineCloudFunction` | ``object (`https://developers.google.com/assistant/actionssdk/reference/rest/Shared.Types/Webhook#InlineCloudFunction`)`` Metadata for cloud function deployed from code in the webhooks folder. |

## Handler

Declares the name of the webhoook handler. A webhook can have multiple handlers registered. These handlers can be called from multiple places in your Actions project.

| YAML representation ||
|---|---|
| ``` name: string ``` |

| Fields ||
|---|---|
| `name` | `string` Required. Name of the handler. Must be unique across all handlers the Actions project. You can check the name of this handler to invoke the correct function in your fulfillment source code. |

## HttpsEndpoint

REST endpoint to notify if you're not using the inline editor.

| YAML representation ||
|---|---|
| ``` baseUrl: string httpHeaders: string: string endpointApiVersion: integer ``` |

| Fields ||
|---|---|
| `baseUrl` | `string` The HTTPS base URL for your fulfillment endpoint (HTTP is not supported). Handler names are appended to the base URL path after a colon (following the style guide in <https://cloud.google.com/apis/design/custom_methods)>. For example a base URL of 'https://gactions.service.com/api' would receive requests with URL 'https://gactions.service.com/api:{method}'. |
| `httpHeaders` | `map (key: string, value: string)` Map of HTTP parameters to be included in the POST request. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `endpointApiVersion` | `integer` Version of the protocol used by the endpoint. This is the protocol shared by all fulfillment types and not specific to Google fulfillment type. |

## InlineCloudFunction

Holds the metadata of an inline Cloud Function deployed from the webhooks folder.

| YAML representation ||
|---|---|
| ``` executeFunction: string ``` |

| Fields ||
|---|---|
| `executeFunction` | `string` The name of the Cloud Function entry point. The value of this field should match the name of the method exported from the source code. |