mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Send messages conforming new facebook policy (#32516)
This commit is contained in:
parent
19254eee30
commit
e02042b33e
@ -97,7 +97,12 @@ class FacebookNotificationService(BaseNotificationService):
|
||||
else:
|
||||
recipient = {"id": target}
|
||||
|
||||
body = {"recipient": recipient, "message": body_message}
|
||||
body = {
|
||||
"recipient": recipient,
|
||||
"message": body_message,
|
||||
"messaging_type": "MESSAGE_TAG",
|
||||
"tag": "ACCOUNT_UPDATE",
|
||||
}
|
||||
resp = requests.post(
|
||||
BASE_URL,
|
||||
data=json.dumps(body),
|
||||
|
@ -30,6 +30,8 @@ class TestFacebook(unittest.TestCase):
|
||||
expected_body = {
|
||||
"recipient": {"phone_number": target[0]},
|
||||
"message": {"text": message},
|
||||
"messaging_type": "MESSAGE_TAG",
|
||||
"tag": "ACCOUNT_UPDATE",
|
||||
}
|
||||
assert mock.last_request.json() == expected_body
|
||||
|
||||
@ -53,6 +55,8 @@ class TestFacebook(unittest.TestCase):
|
||||
expected_body = {
|
||||
"recipient": {"phone_number": target},
|
||||
"message": {"text": message},
|
||||
"messaging_type": "MESSAGE_TAG",
|
||||
"tag": "ACCOUNT_UPDATE",
|
||||
}
|
||||
assert request.json() == expected_body
|
||||
|
||||
@ -77,7 +81,12 @@ class TestFacebook(unittest.TestCase):
|
||||
assert mock.called
|
||||
assert mock.call_count == 1
|
||||
|
||||
expected_body = {"recipient": {"phone_number": target[0]}, "message": data}
|
||||
expected_body = {
|
||||
"recipient": {"phone_number": target[0]},
|
||||
"message": data,
|
||||
"messaging_type": "MESSAGE_TAG",
|
||||
"tag": "ACCOUNT_UPDATE",
|
||||
}
|
||||
assert mock.last_request.json() == expected_body
|
||||
|
||||
expected_params = {"access_token": ["page-access-token"]}
|
||||
|
Loading…
x
Reference in New Issue
Block a user