Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.webhook Namespace Reference

Namespaces

 trigger
 

Classes

class  WebhookView
 

Functions

str async_generate_id ()
 
str async_generate_path (str webhook_id)
 
str async_generate_url (HomeAssistant hass, str webhook_id, bool allow_internal=True, bool allow_external=True, bool|None allow_ip=None, bool|None prefer_external=True)
 
Response async_handle_webhook (HomeAssistant hass, str webhook_id, Request|MockRequest request)
 
None async_register (HomeAssistant hass, str domain, str name, str webhook_id, Callable[[HomeAssistant, str, Request], Awaitable[Response|None]] handler, *bool|None local_only=False, Iterable[str]|None allowed_methods=None)
 
bool async_setup (HomeAssistant hass, ConfigType config)
 
None async_unregister (HomeAssistant hass, str webhook_id)
 
None websocket_handle (HomeAssistant hass, websocket_api.ActiveConnection connection, dict[str, Any] msg)
 
None websocket_list (HomeAssistant hass, websocket_api.ActiveConnection connection, dict[str, Any] msg)
 

Variables

 _LOGGER = logging.getLogger(__name__)
 
 CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
 
tuple DEFAULT_METHODS = (METH_POST, METH_PUT)
 
string DOMAIN = "webhook"
 
tuple SUPPORTED_METHODS = (METH_GET, METH_HEAD, METH_POST, METH_PUT)
 
string URL_WEBHOOK_PATH = "/api/webhook/{webhook_id}"
 

Detailed Description

Webhooks for Home Assistant.

Function Documentation

◆ async_generate_id()

str homeassistant.components.webhook.async_generate_id ( )
Generate a webhook_id.

Definition at line 83 of file __init__.py.

◆ async_generate_path()

str homeassistant.components.webhook.async_generate_path ( str  webhook_id)
Generate the path component for a webhook_id.

Definition at line 113 of file __init__.py.

◆ async_generate_url()

str homeassistant.components.webhook.async_generate_url ( HomeAssistant  hass,
str  webhook_id,
bool   allow_internal = True,
bool   allow_external = True,
bool | None   allow_ip = None,
bool | None   prefer_external = True 
)
Generate the full URL for a webhook_id.

Definition at line 90 of file __init__.py.

◆ async_handle_webhook()

Response homeassistant.components.webhook.async_handle_webhook ( HomeAssistant  hass,
str  webhook_id,
Request | MockRequest   request 
)
Handle a webhook.

Definition at line 119 of file __init__.py.

◆ async_register()

None homeassistant.components.webhook.async_register ( HomeAssistant  hass,
str  domain,
str  name,
str  webhook_id,
Callable[[HomeAssistant, str, Request], Awaitable[Response | None]]  handler,
*bool | None   local_only = False,
Iterable[str] | None   allowed_methods = None 
)
Register a webhook.

Definition at line 40 of file __init__.py.

◆ async_setup()

bool homeassistant.components.webhook.async_setup ( HomeAssistant  hass,
ConfigType  config 
)
Initialize the webhook component.

Definition at line 201 of file __init__.py.

◆ async_unregister()

None homeassistant.components.webhook.async_unregister ( HomeAssistant  hass,
str  webhook_id 
)
Remove a webhook.

Definition at line 76 of file __init__.py.

◆ websocket_handle()

None homeassistant.components.webhook.websocket_handle ( HomeAssistant  hass,
websocket_api.ActiveConnection  connection,
dict[str, Any]  msg 
)
Handle an incoming webhook via the WS API.

Definition at line 267 of file __init__.py.

◆ websocket_list()

None homeassistant.components.webhook.websocket_list ( HomeAssistant  hass,
websocket_api.ActiveConnection  connection,
dict[str, Any]  msg 
)
Return a list of webhooks.

Definition at line 235 of file __init__.py.

Variable Documentation

◆ _LOGGER

homeassistant.components.webhook._LOGGER = logging.getLogger(__name__)
private

Definition at line 27 of file __init__.py.

◆ CONFIG_SCHEMA

homeassistant.components.webhook.CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)

Definition at line 35 of file __init__.py.

◆ DEFAULT_METHODS

tuple homeassistant.components.webhook.DEFAULT_METHODS = (METH_POST, METH_PUT)

Definition at line 31 of file __init__.py.

◆ DOMAIN

string homeassistant.components.webhook.DOMAIN = "webhook"

Definition at line 29 of file __init__.py.

◆ SUPPORTED_METHODS

tuple homeassistant.components.webhook.SUPPORTED_METHODS = (METH_GET, METH_HEAD, METH_POST, METH_PUT)

Definition at line 32 of file __init__.py.

◆ URL_WEBHOOK_PATH

string homeassistant.components.webhook.URL_WEBHOOK_PATH = "/api/webhook/{webhook_id}"

Definition at line 33 of file __init__.py.