How To Modify WhatsApp Chatbot Response

  • Modify chatbot initial response:
    Copy and paste this code:

    
    function custom_whatsapp_response_callback( $message ){
    
        $message = 'This is a custom message.';
    
        return $message;
    
    }
    
    add_filter( 'whatsapp_response', 'custom_whatsapp_response_callback', 10, 1 );
    
    
  • Modify chatbot tracking response:
    Copy and paste this code:

    
    function custom_whatsapp_track_response_callback( $message, $_ship_id ){
        // get shipment status
        $shipment_status = get_post_meta($_ship_id, 'wpcargo_status', true);
    
        $message = 'This is a custom message for track.';
        $message .= 'This is to inform you that your shipment status is ';
        $message .= $shipment_status;
    
        return $message;
    }
    
    add_filter( 'whatsapp_track_response', 'custom_whatsapp_track_response_callback', 10, 2 );
    
    
  • Modify chatbot location response:
    Copy and paste this code:

    
    function custom_whatsapp_location_response_callback( $message ){
    
        $message = 'This is a custom message for location.';
    
        return $message;
    }
    
    add_filter( 'whatsapp_location_response', 'custom_whatsapp_location_response_callback', 10, 1 );
    
    
  • Modify chatbot status response:
    Copy and paste this code:

    
    function custom_whatsapp_status_response_callback( $message ){
    
        $message = 'This is a custom message for status.';
    
        return $message;
    }
    
    add_filter( 'whatsapp_status_response', 'custom_whatsapp_status_response_callback', 10, 1 );
    
    
0
    0
    Your Cart
    Your cart is emptyReturn to Shop