Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Context.MessageId field on Whatsapp #75

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.11.0] - 2025-01-10
### Added
- Context.MessageId on RichMessages supporting WhatsApp for referencing a previous message

## [2.10.0] - 2024-12-30
### Added
- Polymorphic type discriminators on IRichMessage for deserialization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ public class ContactMessage : IRichMessage
/// </summary>
[JsonPropertyName("contacts")]
public Contact[] Contacts { get; set; }

/// <summary>
/// Contextual properties of the message
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,12 @@ public class LocationPushMessage : IRichMessage
/// </summary>
[JsonPropertyName("location")]
public ViewLocationOptions Location { get; set; }

/// <summary>
/// Contextual properties of the message. Only applicable to <see cref="Channel.WhatsApp"/>
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}
}
7 changes: 7 additions & 0 deletions CM.Text/BusinessMessaging/Model/MultiChannel/MediaMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,12 @@ public MediaMessage(string mediaName, string mediaUri, string mimeType)
/// </summary>
[JsonPropertyName("media")]
public MediaContent Media { get; set; }

/// <summary>
/// Contextual properties of the message. Only applicable to <see cref="Channel.WhatsApp"/>
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}
}
19 changes: 19 additions & 0 deletions CM.Text/BusinessMessaging/Model/MultiChannel/MessageContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Text.Json.Serialization;
using JetBrains.Annotations;

namespace CM.Text.BusinessMessaging.Model.MultiChannel
{
/// <summary>
/// Contextual properties of the message. Currently only applicable to <see cref="Channel.WhatsApp" />
/// Docs: https://developers.cm.com/messaging/docs/whatsapp-inbound#mt-replies-mo
/// </summary>
public class MessageContext
{
/// <summary>
/// Message ID to which the current message is a reply
/// </summary>
[JsonPropertyName("message_id")]
[CanBeNull]
public string MessageId { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,12 @@ public class TemplateMessage : IRichMessage
/// </remarks>
[JsonPropertyName("template")]
public TemplateMessageContent Content { get; set; }

/// <summary>
/// Contextual properties of the message
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}
}
7 changes: 7 additions & 0 deletions CM.Text/BusinessMessaging/Model/MultiChannel/TextMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,12 @@ public TextMessage(string text)
/// </summary>
[JsonPropertyName("suggestions")]
public SuggestionBase[] Suggestions { get; set; }

/// <summary>
/// Contextual properties of the message. Currently only applicable to <see cref="Channel.WhatsApp" />
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ public class WhatsAppInteractiveMessage : IRichMessage
/// </summary>
[JsonPropertyName("interactive")]
public WhatsAppInteractiveContent whatsAppInteractiveContent { get; set; }

/// <summary>
/// Contextual properties of the message
/// </summary>
[JsonPropertyName("context")]
[CanBeNull]
public MessageContext MessageContext { get; set; }
}

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions CM.Text/CM.Text.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageIcon>icon.png</PackageIcon>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/../CHANGELOG.md"))</PackageReleaseNotes>
<Version>2.10.0</Version>
<Version>2.11.0</Version>
<PackageProjectUrl>https://github.com/cmdotcom/text-sdk-dotnet</PackageProjectUrl>
<NeutralLanguage>en</NeutralLanguage>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyVersion>2.10.0</AssemblyVersion>
<FileVersion>2.10.0</FileVersion>
<AssemblyVersion>2.11.0</AssemblyVersion>
<FileVersion>2.11.0</FileVersion>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>

Expand Down
Loading