This commit is contained in:
parent
5e98aee93b
commit
b64c7cb474
@ -202,13 +202,21 @@ class FacebookService:
|
|||||||
"""
|
"""
|
||||||
Helper function to post a comment to a specific post.
|
Helper function to post a comment to a specific post.
|
||||||
"""
|
"""
|
||||||
# Prepend mention if sender_id provided
|
# Build the “mention” link (your Page)
|
||||||
if sender_id:
|
prefix = f"https://www.facebook.com/{sender_id}" if sender_id else ""
|
||||||
mention = f"https://www.facebook.com/{sender_id} "
|
|
||||||
message = f"{mention}\n\n{message}\n\n https://wa.me/447887147696"
|
# WhatsApp CTA link
|
||||||
|
whatsapp_link = "https://wa.me/447887147696"
|
||||||
|
|
||||||
|
# Assemble the final message with labels and spacing
|
||||||
|
formatted = "\n\n".join(filter(None, [
|
||||||
|
prefix,
|
||||||
|
message.strip(),
|
||||||
|
f"📱 Chat with us on WhatsApp: {whatsapp_link}"
|
||||||
|
]))
|
||||||
|
|
||||||
url = f"{self.base_url}/{post_id}/comments"
|
url = f"{self.base_url}/{post_id}/comments"
|
||||||
payload = {"message": message, "access_token": access_token}
|
payload = {"message": formatted, "access_token": access_token}
|
||||||
try:
|
try:
|
||||||
response = requests.post(url, data=payload)
|
response = requests.post(url, data=payload)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user