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.
|
||||
"""
|
||||
# Prepend mention if sender_id provided
|
||||
if sender_id:
|
||||
mention = f"https://www.facebook.com/{sender_id} "
|
||||
message = f"{mention}\n\n{message}\n\n https://wa.me/447887147696"
|
||||
# Build the “mention” link (your Page)
|
||||
prefix = f"https://www.facebook.com/{sender_id}" if sender_id else ""
|
||||
|
||||
# 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"
|
||||
payload = {"message": message, "access_token": access_token}
|
||||
payload = {"message": formatted, "access_token": access_token}
|
||||
try:
|
||||
response = requests.post(url, data=payload)
|
||||
response.raise_for_status()
|
||||
|
Loading…
x
Reference in New Issue
Block a user