I have implemented a custom scheduled action to send WhatsApp promotional messages using the Meta WhatsApp Business integration.
The script (screenshot attached) reads a contact list from the System Parameter (promotion.contact.list) and sends messages using the WhatsApp template Wp_honey_7nov.
The scheduled action executes successfully, and no errors appear in the logs. However, the messages are being sent to only around 50% of the contacts in the list each time.
Observation:
When I added 80 phone numbers, messages were sent to 39–40 numbers only.
When I added 160 phone numbers, only 80 messages were sent.
The scheduled action finishes without showing any exception or failure in the logs.
The Meta statistics (attached screenshot) confirm that the number of messages sent is half of what’s expected.
Steps to Reproduce:
Create a system parameter key promotion.contact.list containing a JSON list of 80–160 contacts with names and phone numbers.
Run the scheduled action Send Promotional WhatsApp Message (custom script attached).
Observe that only ~50% of the contacts receive the WhatsApp message, even though the script iterates through all.
Expected Behavior:
All contacts from the system parameter list should receive the WhatsApp message, and the Meta analytics should reflect 100% message delivery.
Actual Behavior:
Only around 50% of the contacts receive the message, despite successful script execution and no errors in Odoo logs........And this is my code :- _logger.info("⏰ Scheduled WhatsApp Promotion Started...")
param_key = "promotion.contact.list"
# param_key = "test.contact.list"
param_value = env['ir.config_parameter'].sudo().get_param(param_key)
if not param_value:
_logger.warning("❌ No contact list found in system parameter.")
else:
try:
contact_list = json.loads(param_value)
template = env['whatsapp.template'].sudo().search([('name', '=', 'Wp_honey_nov25')], limit=1)
if not template:
_logger.error("❌ WhatsApp template 'Offer_1' not found.")
else:
for contact in contact_list:
name = contact.get("name")
phone = contact.get("phone")
if name and phone:
_logger.info(f"📤 Sending to {name} ({phone}) {template.id,
'phone': phone,
# 'free_text_1': name,
# 'free_text_1': 'honey',
'free_text_1': 'products?search=honey',
'res_ids': str(env.ref('base.default_user').id),
'res_model':'res.partner'
})
message.action_send_whatsapp_template()
else:
_logger.warning(f"⚠️ Missing name or phone in contact: {contact}")
except Exception as e:
_logger.error(f"❌ Error during WhatsApp message sending: {str(e)}")