wa-js
wa-js copied to clipboard
For delete and revoke msg use:
For delete and revoke msg use:
await WPP.chat.deleteMessage('[number]@c.us', '[[email protected]_3EB06A9EC8E5624576163', true, true);
Originally posted by @icleitoncosta in https://github.com/wppconnect-team/wa-js/issues/2047#issuecomment-2187646198
this worked to unsend my own messages ,, but it dosen't delete the message for chat , and only works for the messages i sended and can't delete the messages i received
Could you record a video reproducing the error and post it here? I tested with my messages and received messages, and both delete normally.
public async Task<bool> DeleteMessage(string contactId, string messageId)
{
try
{
var jsCode = $@"
async () => {{
try {{
await WPP.chat.deleteMessage('{contactId}@c.us', '{messageId}', true, true);
return {{ success: true }};
}} catch (error) {{
return {{ success: false, error: error.message }};
}}
}}";
dynamic result = await Page.EvaluateFunctionAsync(jsCode).ConfigureAwait(false);
if ((bool)result.success)
{
return true;
}
else
{
LogSvc.AddLog("CLIENT SIDE EXCEPTION: Error deleting message: " + result.error);
return false;
}
}
catch (Exception ex)
{
LogSvc.AddLog("SERVER SIDE EXCEPTION : Error deleting message: " + ex.Message);
return false;
}
}
the thing is it always return True
if i tried in my messages , they will be revoked but not delete , and if i tried on my received messages nothing happend , and no error from javascript or .net side
Fixed by https://github.com/wppconnect-team/wa-js/commit/e8429480485c87cbdf874949ac866ed2b2e27a91