-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added implementation of authentication and MPM template message
- Loading branch information
1 parent
36b0e7a
commit 4b01e2d
Showing
5 changed files
with
287 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
WhatsappBusiness.CloudApi/Messages/Requests/AuthenticationTemplateMessageRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 AuthenticationTemplateMessageRequest | ||
{ | ||
[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 AuthenticationMessageTemplate Template { get; set; } | ||
} | ||
|
||
public class AuthenticationMessageTemplate | ||
{ | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("language")] | ||
public AuthenticationMessageLanguage Language { get; set; } | ||
|
||
[JsonProperty("components")] | ||
public List<AuthenticationMessageComponent> Components { get; set; } | ||
} | ||
|
||
public class AuthenticationMessageComponent | ||
{ | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
[JsonProperty("parameters")] | ||
public List<AuthenticationMessageParameter> 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 AuthenticationMessageParameter | ||
{ | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
[JsonProperty("text")] | ||
public string Text { get; set; } | ||
} | ||
|
||
public class AuthenticationMessageLanguage | ||
{ | ||
[JsonProperty("code")] | ||
public string Code { get; set; } | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
WhatsappBusiness.CloudApi/Messages/Requests/MultiProductTemplateMessageRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
using Newtonsoft.Json; | ||
using System.Collections.Generic; | ||
|
||
namespace WhatsappBusiness.CloudApi.Messages.Requests | ||
{ | ||
public class MultiProductTemplateMessageRequest | ||
{ | ||
[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 MPMTemplate Template { get; set; } | ||
} | ||
|
||
public class MPMTemplate | ||
{ | ||
[JsonProperty("name")] | ||
public string Name { get; set; } | ||
|
||
[JsonProperty("language")] | ||
public MPMLanguage Language { get; set; } | ||
|
||
[JsonProperty("components")] | ||
public List<MPMComponent> Components { get; set; } | ||
} | ||
|
||
public class MPMComponent | ||
{ | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
[JsonProperty("parameters")] | ||
public List<MPMParameter> 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 MPMParameter | ||
{ | ||
[JsonProperty("type")] | ||
public string Type { get; set; } | ||
|
||
[JsonProperty("text", NullValueHandling = NullValueHandling.Ignore)] | ||
public string Text { get; set; } | ||
|
||
[JsonProperty("action", NullValueHandling = NullValueHandling.Ignore)] | ||
public MPMAction Action { get; set; } | ||
} | ||
|
||
public class MPMAction | ||
{ | ||
[JsonProperty("thumbnail_product_retailer_id")] | ||
public string ThumbnailProductRetailerId { get; set; } | ||
|
||
[JsonProperty("sections")] | ||
public List<MPMSection> Sections { get; set; } | ||
} | ||
|
||
public class MPMSection | ||
{ | ||
[JsonProperty("title")] | ||
public string Title { get; set; } | ||
|
||
[JsonProperty("product_items")] | ||
public List<MPMProductItem> ProductItems { get; set; } | ||
} | ||
|
||
public class MPMProductItem | ||
{ | ||
[JsonProperty("product_retailer_id")] | ||
public string ProductRetailerId { get; set; } | ||
} | ||
|
||
public class MPMLanguage | ||
{ | ||
[JsonProperty("code")] | ||
public string Code { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters