sendTextMessage method
sendMessage
may throw errors if passed an invalid contact
or if this method completed without any issue , then probably message sent successfully
add replyMessageId
to quote message
Implementation
Future sendTextMessage({
required String phone,
required String message,
String? templateTitle,
String? templateFooter,
bool useTemplate = false,
List<MessageButtons>? buttons,
MessageId? replyMessageId,
}) async {
String? replyText = replyMessageId?.serialized;
String? buttonsText = buttons?.map((e) => e.toJson()).toList().toString();
return await wpClient.evaluateJs(
'''WPP.chat.sendTextMessage(${phone.phoneParse}, ${message.jsParse}, {
quotedMsg: ${replyText.jsParse},
useTemplateButtons: ${useTemplate.jsParse},
buttons:$buttonsText,
title: ${templateTitle.jsParse},
footer: ${templateFooter.jsParse}
});''',
methodName: "sendTextMessage");
}