formatted message
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ekaropolus 2025-07-22 16:42:01 -06:00
parent 5e98aee93b
commit b64c7cb474

View File

@ -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()