📢 Reply to a message
Send reply to a specific message
await whatsapp.reply(
phoneNumber: 'RECIPIENT_NUMBER',
messageId: 'MESSAGE_ID',
reply: reply().text("Thanks for contacting us", true),
);
param | type | required | description |
---|---|---|---|
phoneNumber | String | yes | Phone number with country code. |
messageId | String | yes | A message ID |
reply | Map<String, dynamic> | yes | Reply content |
reply
For reply to a specific message, you can use reply
class methods, or you can use custom JSON object.
Here is predefined methods for reply:
Text
- Send Text reply
reply().text(
"Thanks for contacting us", //reply Text
true, //URL preview
);
Image
- By Image Id
- By Image Url
reply().imageById(
"1100XXXXXXXXXXXXX", //Image Media ID
);
reply().imageByUrl(
"https://example.com/sample.jpg", //Image direct url
);
Audio
- By Audio Id
- By Audio Url
reply().audioById(
"1100XXXXXXXXXXXXX", //Audio Media ID
);
reply().audioByUrl(
"https://example.com/sample.mp3", //Audio direct url
);
Video
- By Video Id
- By Video Url
reply().videoById(
"1100XXXXXXXXXXXXX", //Video Media ID
);
reply().videoByUrl(
"https://example.com/sample.mp4", //Video direct url
);
Document
- By Document Id
- By Document Url
reply().documentById(
"1100XXXXXXXXXXXXX", //Document Media ID
);
reply().documentByUrl(
"https://example.com/sample.pdf", //Document direct url
);
Custom Object
You can pass your custom object as well. Find documentation here https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-messages/#replies
await whatsapp.reply(
phoneNumber: 'RECIPIENT_NUMBER',
messageId: 'MESSAGE_ID',
reply: {
"type":"image",
"image" : {
"link" :"https://example.com/sample.jpg"
}
},
);