How do I add variables to a template message
anirudhrata opened this issue · 4 comments
Hi, How can I add variables to a template message in the method send_template ?
I have the same question...
In the meantime, I just stopped using heyoo and started using python's standard requests package. downside is you have to configure everything about the request - payload, headers, etc. upside is you have full flexibility and don't depend on any packages.
guidance links:
https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates
https://www.geeksforgeeks.org/get-post-requests-using-python/
component = [{"type": "body","parameters": [{"type": "text","text": "variable_value"},{"type": "text","text": "variable_value"}]}]
response = messenger.send_templatev2("template_name", phone, component)
type value can be changed to footer, header, body as required.
Hi @anirudhrata @dncastilho @pawanbattu
It seems the component arguments were forgotten during the initial implementation, I have updated the source code now you can specify the component arguments + Couple of other useful new methods
>>> messenger.send_template('template_name', components={})
Let me know if you still have issues