Vonage / vonage-java-code-snippets

Java code examples for using Vonage
MIT License
11 stars 31 forks source link

OTP template format #102

Open gcp91020 opened 8 months ago

gcp91020 commented 8 months ago

Hi team,

does the OTP template work? From the java code, the template looks as below, and "language" and "components" are in "custom", and I failed to send OTP with this format. { "message_type": "custom", "channel": "whatsapp", "from": "", "to": "", "custom": { "type": "template", "template": { "name": "" }, "language": { "code": "en", "policy": "deterministic" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "123456" } ] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [ { "type": "text", "text": "123456" } ] } ] } }

while I tried with another format as https://github.com/Vonage/vonage-curl-code-snippets/blob/main/messages/whatsapp/send-authentication-template.sh the format is as below, "language" and "components" were in "template", and it worked as expected. { "message_type": "custom", "channel": "whatsapp", "from": "", "to": "", "custom": { "type": "template", "template": { "name": "", "language": { "code": "en", "policy": "deterministic" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "123456" } ] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [ { "type": "text", "text": "123456" } ] } ] } } }