diff --git a/src/Infrastructure/BotSharp.Abstraction/Messaging/BotSharpMessageParser.cs b/src/Infrastructure/BotSharp.Abstraction/Messaging/BotSharpMessageParser.cs index 25a97b2b9..b545498c8 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Messaging/BotSharpMessageParser.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Messaging/BotSharpMessageParser.cs @@ -42,6 +42,10 @@ public static class BotSharpMessageParser { targetType = typeof(ProgramCodeTemplateMessage); } + else if (richType == RichTypeEnum.EmbeddingTemplate) + { + targetType = typeof(EmbeddingTemplateMessage); + } else if (richType == RichTypeEnum.GenericTemplate) { if (root.TryGetProperty("element_type", out element)) @@ -92,6 +96,10 @@ public static class BotSharpMessageParser { targetType = typeof(ProgramCodeTemplateMessage); } + else if (templateType == TemplateTypeEnum.Embedding) + { + targetType = typeof(EmbeddingTemplateMessage); + } else if (templateType == TemplateTypeEnum.Generic) { if (root.TryGetProperty("element_type", out element)) diff --git a/src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/RichTypeEnum.cs b/src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/RichTypeEnum.cs index 8d66904bb..f25331d53 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/RichTypeEnum.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/RichTypeEnum.cs @@ -6,6 +6,7 @@ public static class RichTypeEnum public const string MultiSelectTemplate = "multi-select_template"; public const string CouponTemplate = "coupon_template"; public const string GenericTemplate = "generic_template"; + public const string EmbeddingTemplate = "embedding_template"; public const string QuickReply = "quick_reply"; public const string Text = "text"; public const string Attachment = "attachment"; diff --git a/src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/TemplateTypeEnum.cs b/src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/TemplateTypeEnum.cs index 73a4e9d4c..acd575e47 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/TemplateTypeEnum.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Messaging/Enums/TemplateTypeEnum.cs @@ -7,4 +7,5 @@ public static class TemplateTypeEnum public const string Generic = "generic"; public const string MultiSelect = "multi-select"; public const string ProgramCode = "program_code"; + public const string Embedding = "embedding"; } diff --git a/src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Template/EmbeddingTemplateMessage.cs b/src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Template/EmbeddingTemplateMessage.cs new file mode 100644 index 000000000..dcc369d98 --- /dev/null +++ b/src/Infrastructure/BotSharp.Abstraction/Messaging/Models/RichContent/Template/EmbeddingTemplateMessage.cs @@ -0,0 +1,22 @@ +namespace BotSharp.Abstraction.Messaging.Models.RichContent.Template; + +public class EmbeddingTemplateMessage : IRichMessage, ITemplateMessage +{ + [JsonPropertyName("rich_type")] + public string RichType => RichTypeEnum.EmbeddingTemplate; + + [JsonPropertyName("title")] + public string Title { get; set; } = string.Empty; + + [JsonPropertyName("text")] + public string Text { get; set; } = string.Empty; + + [JsonPropertyName("html_tag")] + public string HtmlTag { get; set; } = "iframe"; + + [JsonPropertyName("template_type")] + public virtual string TemplateType { get; set; } = TemplateTypeEnum.Embedding; + + [JsonPropertyName("url")] + public string Url { get; set; } = string.Empty; +} \ No newline at end of file