0

I want to send a customized message and/or a document to a list of people everyday using the Whatsapp API.

This is the code I use

import requests
import json
import time

url = f"https://graph.facebook.com/v17.0/{ID}/messages"

payload = json.dumps({
    "messaging_product": "whatsapp",
    "to": person,
    "type": "document",
    "document": {"id":media_id,
        "filename": file_name}
  })


headers = {
  'Authorization': 'Bearer {TOKEN}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

The problem is these messages aren't being delivered. But I understand that there has to be reply from the user initially, for the conversation to continue and for the above defined code to work properly.

The issue here is that there is a 24 hour validity for the conversation,and since I want to send these messages everyday I must get a user reply every day and only then can I send out these messages. Is there a way I can keep sending the messages to the particular user without them replying back every 24 hours or if they reply back to an initial message, they can keep receiving messages indefinitely.

I can't use predefined templates also because as of now only pdf files can be sent in template messages whereas I would need to send pdf,pptx,csv and excel files.

Marvin
  • 49
  • 5

1 Answers1

0

Unfortunately, there is no way to send custom type messages until the customer replies to you in 24 hours window.

This rule is to protect customers from spam messages, and they should get verified and approved messages until they are interested in the business's messages and reply to the business, and why would WhatsApp provide this kind of rule that is breakable?

turivishal
  • 34,368
  • 7
  • 36
  • 59
  • Well, I want to send daily reports of metrics to certain people. Thought there would be some feature where they can accept first and I can send the reports after acceptance. Of course, customers can opt out if they message a particular keyword back. This way a customer could keep getting messages of their metrics once they are interested and won't be spammed and won't have to keep requesting each day. Oh well, if it ain't possible, time to explore a different platform then. – Marvin Jun 15 '23 at 15:47