Ancient Indians used Saltpetre (Agnichurna), the major constituent of gunpowder, to make firecrackers (ulkah) on Diwali. “Gunpowder originated in Ancient India”- Indologist Dr. Gustav Oppert.

The use of Gunpowder in matchlocks proliferated in the middle ages. Ancient Indians used Saltpetre (Agnichurna) in mining and warfare. It was already mentioned by Kautilya in Arthashastra as a weapon of war (4th century BC).
These are noted in “Military Transition in Early Modern Asia”, 1400-1750: Cavalry, Guns, Government and Ships’ by Kaushik Roy.
Even Arabs mention that they got gunpowder from India.

Chemical warfare in Ancient India by Vaman R. Kokatnur J. Chem. Educ., 1948, 25 (5), p 268
https://pubs.acs.org/doi/pdf/10.1021/ed025p268
When Timur, the ancestor Abbu of Mughals invaded India in 1398 CE, Indian troops shot his army with rockets and fireworks. It shocked his troops and they were beaten in the initial engagement.
Even in 13th century, a Mongol foreign ambassador to India was greeted with 3000 celebratory firecars which are much reminiscent of Indian firework celebrations during Dipavali and Kartika Purnima.

Vaisampayana, the narrator of Mahabharata, describes the manufacture of smoke balls by ancient Indians using Gunpowder. Atharvanarahasya mentions the use of charcoal, sulphur and saltpetre to make fireworks, which are the same ingredients used even today to manufacture Gunpowder.

Remarkable sculptures from Hoysaleswara Temple (Halebidu, Karnataka. built c.12th century) show warriors using rockets (fire arrows). Arrows were tipped with Gunpowder / flammable combustibles. They were known as Agnibanas and used together on a launching pad in wars.

A sculpture from Halebidu (12th century) depicting rocket warfare in Ancient India. Notice the launching pad that is holding the missiles/combustible arrows.

While ancient Indians did use Gunpowder, what they did not have was a projecting weapon like a matchlock which could be integrated with the fire. They simply used to tip their arrows with Gunpowder and shoot at the enemy.
Thanks so much for this valuable information….