The apparition at Paray-le-Monial in 1689
After several apparitions revealing the consuming love of the Sacred Heart of Jesus for men, Christ asked Marguerite Marie Alacoque, in 1689, to communicate his wishes to the King of France, Louis XIV. 
Jesus wanted the king to consecrate himself to his Sacred Heart. He wanted the image of this Heart to be painted on his royal banners and engraved on his arms, to make him victorious. He wanted a new place of worship where the image of the Sacred Heart would be exposed, to receive the consecration and the homage of the king and the whole court. He chose the king as his faithful friend, to have the Apostolic Holy See institute a Mass in his honor, and grant all the other privileges that must accompany this devotion to the Sacred Heart. 
Louis XIV did not honor those wishes. His glorious reign was darkened by his licentiousness, his Gallicanism (he named French bishops himself, instead of the pope), the persecution of religious minorities, and finally the issue of his succession. He repented for his actions at the end of his life, but did not fulfill Jesus’ desires.
At the time of Louis XIV, nothing was standardized: kings, princes and military captains each had their own banners and shields, often using lily flowers and blue and white colors. The red color evokes Clovis and Charlemagne, as well as the martyrdom of Saint Denis. White is the color traditionally associated with the French monarchy. Blue is associated with the coat of arms of France; it is a symbol of spiritual greatness and the color of the Virgin Mary’s cloak.
Today’s tri-color French flag in blue, white, and red, dates from the French Revolution (1790), with some brief eclipses: during the Restoration (1815-1830) the flag was white; it became tricolor again in 1830 with a brief interruption again in 1848 (it was then blue, white, and red).
Since then, the blue, white and red flag has not changed. Its color is fixed by Article 2 of the 1958 French Constitution.
The French flag has never borne a representation of the Sacred Heart.
1689-1919: a long wait
Louis XVI was guillotined during the French Revolution, in 1873. The 19th century was politically and socially tumultuous; it was plagued by the injustices of a society undergoing industrial change and anticlerical pressures. To top it all, France lost the war against Prussia in 1870.
It was then that the construction of the Basilica of the Sacred Heart was decreed by a law voted by the National Assembly in July 1873, as part of a new Moral Order. The basilica was built where the violence of the Commune had begun. However, funding did not come from the state but from private donations. It was finished in 1914, but the start of the Great War delayed its solemn dedication, which took place only in 1919, in thanksgiving for the victory—even though it was an ambiguous victory. 
What Sister Lucia of Fatima had to say about this delay
Sister Lucia compared the procrastination of the kings of France to fulfill the desire of Christ at Paray-le-Monial, to the delay of the Catholic hierarchy to fulfill the wishes of the Virgin Mary at Fatima.
Here is a quote from one of Sister’s Lucia’s letters to Father Gonçalves in 1936:
"Later, in an intimate communication, Our Lord told me, in a tone of complaint: ‘They did not want to listen to my request! ... Like the King of France, they will repent, and they will do it, but it will be late, Russia will have already spread her errors in the world, provoking wars and persecutions against the Church. The Holy Father will have much to suffer." 
In this perspective, we can see that although it is expressed in the context of the French monarchy, the message of Paray-le-Monial does not dictate a political choice ("legitimist" or "conservative") but asks for a spiritual renewal of the heart that will bring down heavenly blessings. In retrospect, we can certainly see that it would have prevented the fermentation of atheistic materialism, which fed the thought of Karl Marx (1818-1883) when he was staying in Paris.
The Basilica is a place of perpetual Eucharistic adoration.
Since 1995, the Basilica has been in the material and spiritual care of the Benedictine Congregation of the Sacred Heart of Montmartre.
"My divine heart is so consumed with love for men! ... I have a burning desire to be honored by men in the Blessed Sacrament, and I find almost no one who strives, according to my desire, to quench my thirst, returning this love to me."
(Jesus to Marguerite Marie, December 27, 1673)
 Let us recall that Louis XIII consecrated France and the Crown to the Virgin Mary on August 15, 1638. His son Louis XIV was born on September 5, 1638, after his parents prayed to Our Lady of Grace (Gignac), and his birth was predicted in 1632 in an apparition of the Sacred Heart to a religious sister of Beaune.
 Father Jacques Benoist, Le Sacré-Cœur de Montmartre de 1870 à nos jours, Les éditions ouvrières, 1992 ; Father Jacques Benoist, Le Sacré-Cœur de Montmartre, Un vœu national, Délégation à l'action artistique de la ville de Paris, 1995