Vonage / vonage-dotnet-sdk

Vonage REST API client for .NET, written in C#. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
https://developer.vonage.com/
Apache License 2.0
106 stars 82 forks source link

Missing Delivery receipt class for WhatsApp messages #297

Closed surexxx closed 1 year ago

surexxx commented 1 year ago

I'm started to using Messaging SDK and see that WhatsAppDeliveryReceipt class is missing from SDK.

The JSON structure of message is descibed here: https://developer.vonage.com/api/messages-olympus?theme=dark#message-status

Using the structure above a possible implementation is here:

using Vonage.Messages;

    public class WhatsAppDeliveryReceipt
    {
        [JsonProperty("to")]
        public string To { get; set; }

        [JsonProperty("from")]
        public string From { get; set; }

        [JsonProperty("channel")]
        public MessagesChannel Channel { get; set; }

        [JsonProperty("message_uuid")]
        public string MessageUuid { get; set; }

        [JsonProperty("timestamp")]
        public DateTime Timestamp { get; set; }

        [JsonProperty("usage")]
        public Usage Usage { get; set; }

        [JsonProperty("status")]
        public MessagesDlrStatus Status { get; set; }

        [JsonProperty("whatsapp")]
        public WhatsApp WhatsApp { get; set; }

        [JsonProperty("error")]
        public Error Error { get; set; }

        [JsonProperty("client_ref")]
        public string ClientRef { get; set; }
    }

    public enum MessagesDlrStatus
    {
        submitted,
        delivered,
        rejected,
        undeliverable,
        read
    }

    public class Error
    {
        [JsonProperty("type")]
        public string Type { get; set; }

        [JsonProperty("title")]
        public string Title { get; set; }

        [JsonProperty("detail")]
        public string Detail { get; set; }

        [JsonProperty("instance")]
        public string Instance { get; set; }
    }

    public class Conversation
    {
        [JsonProperty("id")]
        public string Id { get; set; }

        [JsonProperty("origin")]
        public Origin Origin { get; set; }
    }

    public class Origin
    {
        [JsonProperty("type")]
        public string Type { get; set; }
    }

    public class Usage
    {
        [JsonProperty("price")]
        public string Price { get; set; }

        [JsonProperty("currency")]
        public string Currency { get; set; }
    }

    public class WhatsApp
    {
        [JsonProperty("conversation")]
        public Conversation Conversation { get; set; }
    }

Please add this implementation to your dotnet messaging sdk.

Tr00d commented 1 year ago

Hi @surexxx! Thanks for pointing this out and for your contribution. I added this item in my current sprint, so I can reasonably tell it will be done shortly. I'll share feedback regarding the progress. Have a great day!

Tr00d commented 1 year ago

Same reply than similar issue: https://github.com/Vonage/vonage-dotnet-sdk/issues/298#issuecomment-1511028663