Skip to content

Commit

Permalink
Additional message templates added
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrieldwight committed Sep 19, 2023
1 parent e6229dd commit 090b040
Show file tree
Hide file tree
Showing 4 changed files with 309 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace WhatsappBusiness.CloudApi.Messages.Requests
{
public class CarouselTemplateMessageRequest
{
[JsonProperty("messaging_product")]
public string MessagingProduct { get; private set; } = "whatsapp";

[JsonProperty("recipient_type")]
public string RecipientType { get; private set; } = "individual";

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

[JsonProperty("type")]
public string Type { get; private set; } = "template";

[JsonProperty("template")]
public CarouselMessageTemplate Template { get; set; }
}

public class CarouselMessageTemplate
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("language")]
public CarouselMessageLanguage Language { get; set; }

[JsonProperty("components")]
public List<CarouselMessageTemplateComponent> Components { get; set; }
}

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

[JsonProperty("parameters", NullValueHandling = NullValueHandling.Ignore)]
public List<CarouselMessageParameter> Parameters { get; set; }

[JsonProperty("cards", NullValueHandling = NullValueHandling.Ignore)]
public List<CarouselMessageCard> Cards { get; set; }
}

public class CarouselMessageCard
{
[JsonProperty("card_index")]
public int CardIndex { get; set; }

[JsonProperty("components")]
public List<CarouselCardComponent> Components { get; set; }
}

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

[JsonProperty("parameters")]
public List<CardMessageParameter> Parameters { get; set; }

[JsonProperty("sub_type", NullValueHandling = NullValueHandling.Ignore)]
public string SubType { get; set; }

[JsonProperty("index", NullValueHandling = NullValueHandling.Ignore)]
public long? Index { get; set; }
}

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

[JsonProperty("image", NullValueHandling = NullValueHandling.Ignore)]
public CardImage Image { get; set; }

[JsonProperty("text", NullValueHandling = NullValueHandling.Ignore)]
public string Text { get; set; }

[JsonProperty("payload", NullValueHandling = NullValueHandling.Ignore)]
public string Payload { get; set; }
}

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

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

[JsonProperty("text")]
public string Text { get; set; }
}

public class CarouselMessageLanguage
{
[JsonProperty("code")]
public string Code { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using Newtonsoft.Json;

namespace WhatsappBusiness.CloudApi.Messages.Requests
{
public class CatalogMessageRequest
{
[JsonProperty("messaging_product")]
public string MessagingProduct { get; set; }

[JsonProperty("recipient_type")]
public string RecipientType { get; set; }

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

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

[JsonProperty("interactive")]
public CatalogMessageInteractive Interactive { get; set; }
}

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

[JsonProperty("body")]
public CatalogMessageBody Body { get; set; }

[JsonProperty("action")]
public CatalogMessageAction Action { get; set; }

[JsonProperty("footer")]
public CatalogMessageFooter Footer { get; set; }
}

public class CatalogMessageAction
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("parameters")]
public CatalogMessageParameters Parameters { get; set; }
}

public class CatalogMessageParameters
{
[JsonProperty("thumbnail_product_retailer_id")]
public string ThumbnailProductRetailerId { get; set; }
}

public class CatalogMessageBody
{
[JsonProperty("text")]
public string Text { get; set; }
}

public class CatalogMessageFooter : CatalogMessageBody
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace WhatsappBusiness.CloudApi.Messages.Requests
{
public class CatalogTemplateMessageRequest
{
[JsonProperty("messaging_product")]
public string MessagingProduct { get; private set; } = "whatsapp";

[JsonProperty("recipient_type")]
public string RecipientType { get; private set; } = "individual";

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

[JsonProperty("type")]
public string Type { get; private set; } = "template";

[JsonProperty("template")]
public CatalogMessageTemplate Template { get; set; }
}

public class CatalogMessageTemplate
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("language")]
public CatalogMessageLanguage Language { get; set; }

[JsonProperty("components")]
public List<CatalogMessageComponent> Components { get; set; }
}

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

[JsonProperty("parameters")]
public List<CatalogTemplateMessageParameter> Parameters { get; set; }

[JsonProperty("sub_type", NullValueHandling = NullValueHandling.Ignore)]
public string SubType { get; set; }

[JsonProperty("index", NullValueHandling = NullValueHandling.Ignore)]
public long? Index { get; set; }
}

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

[JsonProperty("text", NullValueHandling = NullValueHandling.Ignore)]
public string Text { get; set; }

[JsonProperty("action", NullValueHandling = NullValueHandling.Ignore)]
public CatalogTemplateMessageAction Action { get; set; }
}

public class CatalogTemplateMessageAction
{
[JsonProperty("thumbnail_product_retailer_id")]
public string ThumbnailProductRetailerId { get; set; }
}

public class CatalogMessageLanguage
{
[JsonProperty("code")]
public string Code { get; set; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace WhatsappBusiness.CloudApi.Messages.Requests
{
public class CouponCodeTemplateMessageRequest
{
[JsonProperty("messaging_product")]
public string MessagingProduct { get; private set; } = "whatsapp";

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

[JsonProperty("type")]
public string Type { get; private set; } = "template";

[JsonProperty("template")]
public CouponCodeMessageTemplate Template { get; set; }
}

public class CouponCodeMessageTemplate
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("language")]
public CouponCodeMessageLanguage Language { get; set; }

[JsonProperty("components")]
public List<CouponCodeMessageComponent> Components { get; set; }
}

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

[JsonProperty("parameters")]
public List<CouponCodeMessageParameter> Parameters { get; set; }

[JsonProperty("sub_type", NullValueHandling = NullValueHandling.Ignore)]
public string SubType { get; set; }

[JsonProperty("index", NullValueHandling = NullValueHandling.Ignore)]
public int? Index { get; set; }
}

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

[JsonProperty("text", NullValueHandling = NullValueHandling.Ignore)]
public string Text { get; set; }

[JsonProperty("coupon_code", NullValueHandling = NullValueHandling.Ignore)]
public string CouponCode { get; set; }
}

public class CouponCodeMessageLanguage
{
[JsonProperty("code")]
public string Code { get; set; }
}
}

0 comments on commit 090b040

Please sign in to comment.