Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for parameters on send_template #1

Open
dardoguidobono opened this issue May 24, 2022 · 7 comments
Open

Support for parameters on send_template #1

dardoguidobono opened this issue May 24, 2022 · 7 comments

Comments

@dardoguidobono
Copy link

https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates

add support for setting the header parameters
{ "messaging_product": "whatsapp", "to": "5XXXXXXXXXXX", "type": "template", "template": { "name": "test_template", "language": { "code": "es_MX" }, "components": [{ "type": "header", "parameters": [ { "type": "text","text": "111" } ] } ] } }
and body parameters like this
{ "messaging_product": "whatsapp", "to": "5XXXXXXXXXXX", "type": "template", "template": { "name": "prueba_confirmacion_turno", "language": { "code": "es_MX" }, "components": [{ "type": "body", "parameters": [ { "type": "text","text": "111" },{ "type": "text","text": "222" },{ "type": "text","text": "333" },{ "type": "text","text": "444" } ] } ] } }

@pro-cms
Copy link
Owner

pro-cms commented May 24, 2022

Hello @dardoguidobono Thanks for the suggestion, if I understood correctly its about Interactive Message Templates, ill work on that and update asap or you can create a pull request if you already have one. It should be available soon.

@dardoguidobono
Copy link
Author

currently i don't have it sorted yet, the 3rd parameter for send_template is optional
send_template($template, $recipient_id, $lang = "en_US")
so probably i have to add 3 new arrays of parameters for the sections header, body, and button.
and add the different kind of parameter classes ( Text, Date, Currency, Etc).
send_template($template, $recipient_id, $lang = "en_US", $parameters_header = [], $parameters_body = [], $parameters_button = [])
or create a new function with the extended parameters.

D.

@aalbarca
Copy link

I have just created a similar package with support for template components. Should we unify both projects and collaborate together?

@m7mdcc
Copy link

m7mdcc commented May 29, 2022

I have just created a similar package with support for template components. Should we unify both projects and collaborate together?

Yes Please !

@bihariraj
Copy link

how can we use variables in template ?

@neckish
Copy link

neckish commented Sep 10, 2022

Hi! any news about request?

@rupadana
Copy link
Contributor

You can use it now like this

Sample

$tsap->sendTemplate('template_name', '6283xxxxxx', 'en_US', [
"Hello World",
]);

equivalent to

$tsap->sendTemplate('template_name', '6283xxxxxx', 'en_US', [
[
"type" => "text",
"text" => "Hello World"
],
]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants