mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Support to use Whatsapp numbers (fixes ##28065) (#28078)
This commit is contained in:
parent
77d55a3b15
commit
acee87bef6
@ -1,9 +1,12 @@
|
|||||||
"""Support for Twilio."""
|
"""Support for Twilio."""
|
||||||
|
from twilio.rest import Client
|
||||||
|
from twilio.twiml import TwiML
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.const import CONF_WEBHOOK_ID
|
from homeassistant.const import CONF_WEBHOOK_ID
|
||||||
from homeassistant.helpers import config_entry_flow
|
from homeassistant.helpers import config_entry_flow
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
CONF_ACCOUNT_SID = "account_sid"
|
CONF_ACCOUNT_SID = "account_sid"
|
||||||
@ -28,8 +31,6 @@ CONFIG_SCHEMA = vol.Schema(
|
|||||||
|
|
||||||
async def async_setup(hass, config):
|
async def async_setup(hass, config):
|
||||||
"""Set up the Twilio component."""
|
"""Set up the Twilio component."""
|
||||||
from twilio.rest import Client
|
|
||||||
|
|
||||||
if DOMAIN not in config:
|
if DOMAIN not in config:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -42,8 +43,6 @@ async def async_setup(hass, config):
|
|||||||
|
|
||||||
async def handle_webhook(hass, webhook_id, request):
|
async def handle_webhook(hass, webhook_id, request):
|
||||||
"""Handle incoming webhook from Twilio for inbound messages and calls."""
|
"""Handle incoming webhook from Twilio for inbound messages and calls."""
|
||||||
from twilio.twiml import TwiML
|
|
||||||
|
|
||||||
data = dict(await request.post())
|
data = dict(await request.post())
|
||||||
data["webhook_id"] = webhook_id
|
data["webhook_id"] = webhook_id
|
||||||
hass.bus.async_fire(RECEIVED_DATA, dict(data))
|
hass.bus.async_fire(RECEIVED_DATA, dict(data))
|
||||||
|
@ -3,7 +3,6 @@ from homeassistant.helpers import config_entry_flow
|
|||||||
|
|
||||||
from .const import DOMAIN
|
from .const import DOMAIN
|
||||||
|
|
||||||
|
|
||||||
config_entry_flow.register_webhook_flow(
|
config_entry_flow.register_webhook_flow(
|
||||||
DOMAIN,
|
DOMAIN,
|
||||||
"Twilio Webhook",
|
"Twilio Webhook",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/twilio",
|
"documentation": "https://www.home-assistant.io/integrations/twilio",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"twilio==6.19.1"
|
"twilio==6.32.0"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"webhook"
|
"webhook"
|
||||||
|
@ -4,14 +4,13 @@ import urllib
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.twilio import DATA_TWILIO
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
|
|
||||||
from homeassistant.components.notify import (
|
from homeassistant.components.notify import (
|
||||||
ATTR_TARGET,
|
ATTR_TARGET,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
|
from homeassistant.components.twilio import DATA_TWILIO
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -3,15 +3,14 @@ import logging
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.twilio import DATA_TWILIO
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
|
|
||||||
from homeassistant.components.notify import (
|
from homeassistant.components.notify import (
|
||||||
|
ATTR_DATA,
|
||||||
ATTR_TARGET,
|
ATTR_TARGET,
|
||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
ATTR_DATA,
|
|
||||||
)
|
)
|
||||||
|
from homeassistant.components.twilio import DATA_TWILIO
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -26,6 +25,7 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|||||||
r"^\+?[1-9]\d{1,14}$|"
|
r"^\+?[1-9]\d{1,14}$|"
|
||||||
r"^(?=.{1,11}$)[a-zA-Z0-9\s]*"
|
r"^(?=.{1,11}$)[a-zA-Z0-9\s]*"
|
||||||
r"[a-zA-Z][a-zA-Z0-9\s]*$"
|
r"[a-zA-Z][a-zA-Z0-9\s]*$"
|
||||||
|
r"^(?:[a-zA-Z]+)\:?\+?[1-9]\d{1,14}$|"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1909,7 +1909,7 @@ tuyaha==0.0.4
|
|||||||
twentemilieu==0.1.0
|
twentemilieu==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.twilio
|
# homeassistant.components.twilio
|
||||||
twilio==6.19.1
|
twilio==6.32.0
|
||||||
|
|
||||||
# homeassistant.components.upcloud
|
# homeassistant.components.upcloud
|
||||||
upcloud-api==0.4.3
|
upcloud-api==0.4.3
|
||||||
|
@ -596,7 +596,7 @@ transmissionrpc==0.11
|
|||||||
twentemilieu==0.1.0
|
twentemilieu==0.1.0
|
||||||
|
|
||||||
# homeassistant.components.twilio
|
# homeassistant.components.twilio
|
||||||
twilio==6.19.1
|
twilio==6.32.0
|
||||||
|
|
||||||
# homeassistant.components.uvc
|
# homeassistant.components.uvc
|
||||||
uvcclient==0.11.0
|
uvcclient==0.11.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user