webhook 1
from whatsapp . models import ContactAttribute from chat . models import Chat from automation . models import Node , FlowExecution , Edge , FlowInteraction import requests from contact . models import Contact as C1 from django . utils import timezone def handle_text_message ( message_text , contact , brand , message_id , timestamp ): """Handle text messages and check for flow triggers""" # Check for trigger nodes that match the message text trigger_nodes = Node . objects . filter ( flow__brand = brand , flow__is_active = True , node_type = 'TRIGGER' , trigger_type = 'KEYWORDS' , ) for node in trigger_nodes : keywords = node . keywords or [] if any ( keyword .lower() in message_text .lower() for keyword in keywords ): # Start flow execution start_flow_execution ( node . flow , contact , node ) ...