The deleting chat is dependent on how is your server side setup
In our case server maintains 2 copies of messages for sender and receiver.
We use IQ stanza to delete chat, satanza is as follows
SENDER:
<iq type="set" id="B4032092-E3EE-4AA3-90A2-4C38A9807407"><query xmlns="urn:xmpp:mam:1"><x xmlns="jabber:x:data" type="submit"><field var="FORM_TYPE" type="hidden"><value>urn:xmpp:mam:1</value></field><field var="start"><value>2019-04-17T12:20:42Z</value></field></x><set xmlns="http://jabber.org/protocol/rsm"><max>10</max></set></query></iq>
ACK FROM SERVER:
<iq type="set" id="9f22eb11-c0e8-410f-bb8c-54e95a4f2f80=7FE2EFBD-E92A-41BF-B7C7-FC7749728F3A"><query xmlns="urn:xmpp:mam:2" queryId="9f22eb11-c0e8-410f-bb8c-54e95a4f2f80=10D528E8-BA5D-498C-B54C-85DFD01DAE5A"><x xmlns="jabber:x:data" type="submit"><field var="FORM_TYPE" type="hidden"><value>urn:xmpp:mam:2</value></field><field var="end"><value>2019-04-17T12:39:22Z</value></field><field var="with"><value>9f22eb11-c0e8-410f-bb8c-54e95a4f2f80@localhost</value></field></x><set xmlns="http://jabber.org/protocol/rsm"><max>30</max><before/><reversed/></set></query></iq>
I'm sure it won't fix it directly, but it should give a hint to you.