diff --git a/CHANGELOG.md b/CHANGELOG.md index fdfcdfba..d76a5010 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Change Log +## [5.34.0](https://github.com/plivo/plivo-dotnet/tree/v5.34.0) (2023-10-13) +**Feature - WhatsApp message support** +- Added new params `template`, `template_json_string` and new message_type `whatsapp` to [send message API](https://www.plivo.com/docs/sms/api/message#send-a-message) +- Added new `message_state` (`read`), `message_type`(`whatsapp`), `conversation_id`, `conversation_origin`, `conversation_expiration_timestamp` in [list all messages API](https://www.plivo.com/docs/sms/api/message#list-all-messages) and [get message details API](https://www.plivo.com/docs/sms/api/message#retrieve-a-message) response + ## [5.33.0](https://github.com/plivo/plivo-dotnet/tree/v5.33.0) (2023-08-25) **Feature - Added New Param 'carrier_fees', 'carrier_fees_rate', 'destination_network' in Get Message and List Message APIs** - Added new params on message get and list response diff --git a/README.md b/README.md index cc82b07b..a4dd8946 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,13 @@ You can install this SDK either by referencing the .dll file or using NuGet. Use the following line to install the latest SDK using the NuGet CLI. ``` -PM> Install-Package Plivo -Version 5.33.0 +PM> Install-Package Plivo -Version 5.34.0 ``` You can also use the .NET CLI to install this package as follows ``` -> dotnet add package Plivo --version 5.33.0 +> dotnet add package Plivo --version 5.34.0 ``` ## Getting started diff --git a/src/Plivo/Plivo.csproj b/src/Plivo/Plivo.csproj index 2aad58d0..d6ab36f5 100644 --- a/src/Plivo/Plivo.csproj +++ b/src/Plivo/Plivo.csproj @@ -1,7 +1,7 @@ netstandard2.0;netstandard1.3 - 5.33.0 + 5.34.0 Plivo SDKs Team Plivo Inc. diff --git a/src/Plivo/Plivo.nuspec b/src/Plivo/Plivo.nuspec index 528ccdbd..53f05444 100644 --- a/src/Plivo/Plivo.nuspec +++ b/src/Plivo/Plivo.nuspec @@ -4,7 +4,7 @@ A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML A .NET SDK to make voice calls and send SMS using Plivo and to generate Plivo XML Plivo - 5.33.0 + 5.34.0 Plivo Plivo SDKs Team Plivo, Inc. @@ -12,6 +12,7 @@ http://github.com/plivo/plivo-dotnet false + * 5.34.0 Added new params `template`, `template_json_string` and message_type `whatsapp`in send message API. Added new `message_state` (`read`), `message_type` (`whatsapp`), `conversation_id`, `conversation_origin`, `conversation_expiration_timestamp` in List Message and Get Message APIs. * 5.33.0 Added New Params `DestinationNetwork`, `CarrierFeesRate`, `CarrierFees`. * 5.32.0 Added New Params `DLTEntityID`, `DLTTemplateID`, `DLTTemplateCategory`. * 5.31.0 Added functionality to start, stop and fetch audio streams diff --git a/src/Plivo/Resource/Message/Message.cs b/src/Plivo/Resource/Message/Message.cs index 74114420..dc9052df 100755 --- a/src/Plivo/Resource/Message/Message.cs +++ b/src/Plivo/Resource/Message/Message.cs @@ -160,6 +160,24 @@ public class Message : Resource /// DLT Template Category. public string DltTemplateCategory { get; set; } + /// + /// Gets or sets the conversation id. + /// + /// The conversation id. + public string ConversationId { get; set; } + + /// + /// Gets or sets the conversation origin. + /// + /// The conversation origin. + public string ConversationOrigin { get; set; } + + /// + /// Gets or sets the conversation expiration timestamp. + /// + /// The conversation expiration timestamp. + public string ConversationExpirationTimestamp { get; set; } + public override string ToString() { return "\n" + @@ -188,7 +206,10 @@ public override string ToString() "ReplacedSender: " + ReplacedSender + "\n" + "DLTEntityID: " + DltEntityId + "\n" + "DLTTemplateID: " + DltTemplateId + "\n" + - "DLTTemplateCategory: " + DltTemplateCategory + "\n"; + "DLTTemplateCategory: " + DltTemplateCategory + "\n" + + "ConversationID: " + ConversationId + "\n" + + "ConversationOrigin: " + ConversationOrigin + "\n" + + "ConversationExpirationTimestamp: " + ConversationExpirationTimestamp + "\n"; } #region ListMedia /// diff --git a/src/Plivo/Resource/Message/MessageInterface.cs b/src/Plivo/Resource/Message/MessageInterface.cs index 321e5530..f6d68a54 100755 --- a/src/Plivo/Resource/Message/MessageInterface.cs +++ b/src/Plivo/Resource/Message/MessageInterface.cs @@ -4,6 +4,7 @@ using System.Reflection; using System.Threading.Tasks; using Plivo.Client; +using Newtonsoft.Json; namespace Plivo.Resource.Message @@ -41,16 +42,43 @@ public MessageInterface(HttpClient client) : base(client) /// dlt_entity_id /// dlt_template_id /// dlt_template_category + /// template + /// template_json_string public MessageCreateResponse Create( List dst, string text = null, string src = null, string type = null, string url = null, string method = null, bool? log = null, bool? trackable = null, string powerpack_uuid = null, string[] media_urls = null, string[] media_ids = null, - string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null) + string dlt_entity_id = null, string dlt_template_id = null, string dlt_template_category = null, Template template = null, string template_json_string = null) { string _dst = string.Join("<", dst); Dictionary data = null; var mandatoryParams = new List { "" }; + // Adding validations for whatsapp cases with template passed + if (template_json_string != null && template != null) + { + return getResponseValidation("Template parameter is already set."); + } + else + { + if (template_json_string != null) + { + var settings = new JsonSerializerSettings{NullValueHandling = NullValueHandling.Ignore}; + template = JsonConvert.DeserializeObject