Skip to content

Commit

Permalink
Merge pull request #36 from cmdotcom/feature/interactive
Browse files Browse the repository at this point in the history
add media in reply buttons
  • Loading branch information
EricSmekens authored Sep 10, 2021
2 parents dc402c9 + 9914c70 commit dc0660a
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ 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.2.1] - 2021-09-10
- Add support for reply buttons with media

## [2.2.0] - 2021-09-09
- Add support for interactive whatsapp messages

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public class InteractiveHeader
/// </summary>
[JsonProperty("text")]
public string Text { get; set; }

[JsonProperty("media")]
public MediaContent Media { get; set; }
}
public class InteractiveBody
{
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 @@ -12,13 +12,13 @@
<Copyright>2020 CM.com</Copyright>
<PackageLicenseUrl>https://mit-license.org</PackageLicenseUrl>
<PackageReleaseNotes>See CHANGELOG.md for details</PackageReleaseNotes>
<Version>2.2.0</Version>
<Version>2.2.1</Version>
<PackageIconUrl>http://static.cmtelecom.com/images/cm-nuget.png</PackageIconUrl>
<PackageProjectUrl>https://github.com/cmdotcom/text-sdk-dotnet</PackageProjectUrl>
<NeutralLanguage>en</NeutralLanguage>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyVersion>2.2.0.0</AssemblyVersion>
<FileVersion>2.2.0.0</FileVersion>
<AssemblyVersion>2.2.1.0</AssemblyVersion>
<FileVersion>2.2.1.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,62 @@ var client = new TextClient(apiKey);

var message = builder.Build();
var result = await client.SendMessageAsync(message);
```
```

Only with Reply buttons you can send media like image,video or document
see following example.

```cs
var apiKey = new Guid(ConfigurationManager.AppSettings["ApiKey"]);
var client = new TextClient(apiKey);
var builder = new MessageBuilder("Message Text", "Sender_name", "Recipient_PhoneNumber");
builder.WithAllowedChannels(Channel.WhatsApp).WithInteractive(new CM.Text.BusinessMessaging.Model.MultiChannel.WhatsAppInteractiveMessage()
{
whatsAppInteractiveContent = new CM.Text.BusinessMessaging.Model.MultiChannel.WhatsAppInteractiveContent()
{
Type = "button",
Header = new CM.Text.BusinessMessaging.Model.MultiChannel.InteractiveHeader()
{
Type = "image",
Media = new CM.Text.BusinessMessaging.Model.MultiChannel.MediaContent()
{
MediaUri = "https://www.cm.com/cdn/web/blog/content/logo-cmcom.png"
}

},
Body = new CM.Text.BusinessMessaging.Model.MultiChannel.InteractiveBody()
{
Text = "checkout our reply message demo"
},
Action = new CM.Text.BusinessMessaging.Model.MultiChannel.InteractiveAction()
{
Buttons = new CM.Text.BusinessMessaging.Model.MultiChannel.InteractiveButton[]
{
new CM.Text.BusinessMessaging.Model.MultiChannel.InteractiveButton()
{
Type = "reply",
Reply = new CM.Text.BusinessMessaging.Model.MultiChannel.ReplyMessage()
{
Id = "unique-postback-id1",
Title = "First Button"
}
},
new CM.Text.BusinessMessaging.Model.MultiChannel.InteractiveButton()
{
Type = "reply",
Reply = new CM.Text.BusinessMessaging.Model.MultiChannel.ReplyMessage()
{
Id = "unique-postback-id2",
Title = "Second Button "
}
}
}
}
}
});

var message = builder.Build();
var result = await client.SendMessageAsync(message);
```


0 comments on commit dc0660a

Please sign in to comment.