📢 Replay a message
Send replay to a specific message
await whatsapp.replay(
phoneNumber: 'PHONE_NUMBER',
messageId: 'MESSAGE_ID',
replay: Replay().text("Thank for contacting us", true),
);
param | type | required | description |
---|---|---|---|
phoneNumber | String | yes | Phone number with county code and plus. |
messageId | String | yes | A message id |
replay | Map<String, dynamic> | yes | Replay Content |
Replay
For replay to a specific message, you can use Replay
class methods, our you can use custom json object.
Here is predefined methods for Replay:
Text
- Send Text Replay
Replay().text(
"Thank for contacting us", //Replay Text
true, //Url preview
);
Image
- By Image Id
- By Image Url
Replay().imageById(
"1100XXXXXXXXXXXXX", //Image Media ID
);
Replay().imageByUrl(
"https:://example.com/sample.jpg", //Image direct url
);
Audio
- By Audio Id
- By Audio Url
Replay().audioById(
"1100XXXXXXXXXXXXX", //Audio Media ID
);
Replay().audioByUrl(
"https:://example.com/sample.mp3", //Audio direct url
);
Video
- By Video Id
- By Video Url
Replay().videoById(
"1100XXXXXXXXXXXXX", //Video Media ID
);
Replay().videoByUrl(
"https:://example.com/sample.mp4", //Video direct url
);
Document
- By Document Id
- By Document Url
Replay().documentById(
"1100XXXXXXXXXXXXX", //Document Media ID
);
Replay().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.replay(
phoneNumber: 'PHONE_NUMBER',
messageId: 'MESSAGE_ID',
replay: {
"type":"image",
"image" : {
"link" :"https://example.com/sample.jpg"
}
},
);