diff --git a/CHANGELOG.md b/CHANGELOG.md index b236081a..3f596298 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ # Change Log +## [5.45.5](https://github.com/plivo/plivo-java/tree/v5.45.5) (2025-02-25) +**Enhancement - Supporting parameter_name in WhatsApp Template .** +- Supporting parameter_name in WhatsApp Template . + ## [5.45.4](https://github.com/plivo/plivo-java/tree/v5.45.4)(2025-02-18) **Feature - Throw GeoPermissionException on synchronous geopermissions error** diff --git a/README.md b/README.md index d29d53ec..1461c707 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The Plivo Java SDK makes it simpler to integrate communications into your Java a ### To Install Stable release -You can use this SDK by adding it as a dependency in your dependency management tool. Alternatively, you can use the [JAR file](https://search.maven.org/remotecontent?filepath=com/plivo/plivo-java/5.45.4/plivo-java-5.45.4.jar). +You can use this SDK by adding it as a dependency in your dependency management tool. Alternatively, you can use the [JAR file](https://search.maven.org/remotecontent?filepath=com/plivo/plivo-java/5.45.5/plivo-java-5.45.5.jar). If you are using Maven, use the following XML to include the Plivo SDK as a dependency. @@ -19,13 +19,13 @@ If you are using Maven, use the following XML to include the Plivo SDK as a depe com.plivo plivo-java - 5.45.4 + 5.45.5 ``` If you are using Gradle, use the following line in your dependencies. ``` -compile 'com.plivo:plivo-java:5.45.4' +compile 'com.plivo:plivo-java:5.45.5' ``` ### To Install Beta release @@ -569,6 +569,42 @@ class Test } ``` +#### Templated WhatsApp Messages With Named Parameter +This guide shows how to send templated WhatsApp messages with named parameters. + +Example: +```java +import java.io.IOException; +import java.net.URL; +import java.util.Collections; + +import com.plivo.api.Plivo; +import com.plivo.api.exceptions.PlivoRestException; +import com.plivo.api.models.message.Message; +import com.plivo.api.models.message.MessageCreateResponse; +import com.plivo.api.models.message.MessageType; +import com.fasterxml.jackson.databind.ObjectMapper; + +class Test +{ + public static void main(String [] args) + { + Plivo.init("", ""); + try { + String templateJson = "{\"name\":\"template_name\",\"language\":\"en_US\",\"components\":[{\"type\":\"header\",\"parameters\":[{\"type\":\"text\",\"parameter_name\":\"header_title\",\"text\":\"WA-header\"}]},{\"type\":\"body\",\"parameters\":[{\"type\":\"text\",\"parameter_name\":\"user_name\",\"text\":\"Saurabh\"}]}]}"; + + MessageCreateResponse response = Message.creator("+14156667778","+14156667777").type(MessageType.WHATSAPP).template_json_string(templateJson).create(); + ObjectMapper ow = new ObjectMapper(); + String json_output = ow.writeValueAsString(response); + System.out.println(json_output); + } + catch (PlivoRestException | IOException e) { + e.printStackTrace(); + } + } +} +``` + ### More examples More examples are available [here](https://github.com/plivo/plivo-examples-java). Also refer to the [guides for configuring the Java Spring to run various scenarios](https://plivo.com/docs/sms/quickstart/java-spring/) & use it to test out your integration in under 5 minutes. diff --git a/pom.properties b/pom.properties index b3791d90..ccc36ab0 100644 --- a/pom.properties +++ b/pom.properties @@ -1,6 +1,6 @@ # Written manually. -version=5.45.4 +version=5.45.5 groupId=com.plivo artifactId=plivo-java diff --git a/pom.xml b/pom.xml index 114dc66f..8155c597 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.plivo plivo-java - 5.45.4 + 5.45.5 plivo-java A Java SDK to make voice calls & send SMS using Plivo and to generate Plivo XML diff --git a/src/main/java/com/plivo/api/models/message/Parameter.java b/src/main/java/com/plivo/api/models/message/Parameter.java index 42a659e3..79209fa4 100644 --- a/src/main/java/com/plivo/api/models/message/Parameter.java +++ b/src/main/java/com/plivo/api/models/message/Parameter.java @@ -11,7 +11,9 @@ public class Parameter { private Currency currency; private DateTime date_time; private Location location; + private String parameter_name; + public Parameter() { } @@ -71,4 +73,11 @@ public void setLocation(Location location) { this.location = location; } + public String getParameter_name() { + return parameter_name; + } + + public void setParameter_name(String parameter_name) { + this.parameter_name = parameter_name; + } } \ No newline at end of file diff --git a/src/main/resources/com/plivo/api/version.txt b/src/main/resources/com/plivo/api/version.txt index a637ab28..0315a169 100644 --- a/src/main/resources/com/plivo/api/version.txt +++ b/src/main/resources/com/plivo/api/version.txt @@ -1 +1 @@ -5.45.4 +5.45.5