Skip to content

CRM Notification fails when WhatsApp message has no assigned user (to_user mandatory error) #1715

@nilpatel42

Description

@nilpatel42

When receiving an incoming WhatsApp message via frappe_whatsapp webhook, a CRM Notification is created automatically.
If no user is assigned (agent is None), the system throws a MandatoryError because to_user is required.

This causes the webhook request to fail even though the WhatsApp message is successfully received

Error

frappe.exceptions.MandatoryError:
[CRM Notification]: to_user

Behavior

  • Webhook crashes when to_user is None

Notes

  • Happens for incoming WhatsApp messages
  • Triggered from crm/api/whatsapp.py → notify_agent → notify_user
  • assigned_users can be [None]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions