rohit-chouhan / whatsapp

A package for whatsapp business api, send messages, product, media, location through flutter app.
https://pub.dev/packages/whatsapp
MIT License
25 stars 19 forks source link

Update for messagesTemplate #11

Closed Roberto9991 closed 4 months ago

Roberto9991 commented 1 year ago

Hello, through the screens you can use variables. the change should be the following: `/// Send the template to the client. /// [to] is the phone number with country code but without the plus (+) sign. /// [templateName] is the template name. /// [message] is the message to be sent. Future messagesTemplate({int? to, String? templateName, String? message}) async { var url = 'https://graph.facebook.com/v15.0/$_fromNumberId/messages'; Uri uri = Uri.parse(url);

Map data = {
  "messaging_product": "whatsapp",
  "to": to,
  "type": "template",
  "template": {
    "name": templateName,
    "language": {"code": "es_AR"},
    "components": [
    {
        "type": "body",
        "parameters": [{
                "type": "text",
                "text": message
            }]
    }
  ]
  }
};

` my english is not very good i hope you understand

iampopal commented 5 months ago

We also need the variables and language flexibility feature as parameters

rohit-chouhan commented 4 months ago

Sorry for the delay, we have released new version. now you can have language flexibility. please find more details here : https://whatsapp-flutter.github.io/docs/methods/messages/send-a-template

Please let me know, if you need any support.