Skip to content

Commit ee109b5

Browse files
fix: simplified unit tests and add support for multiple .net versions
1 parent 56bd9cf commit ee109b5

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

examples/snippets/conversation/messages/SendOrderDetailsPaymentButtons/SendOrderDetailsPaymentButtons.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Sinch.Conversation.Messages.Message;
55
using Sinch.Conversation.Messages.Message.ChannelSpecificMessages.WhatsApp;
66
using Sinch.Conversation.Messages.Send;
7+
using Sinch.Core;
78
using Sinch.Snippets.Shared;
89

910
var projectId = ConfigurationHelper.GetProjectId() ?? "MY_PROJECT_ID";
@@ -12,9 +13,9 @@
1213
var conversationRegion = ConfigurationHelper.GetConversationRegion() ?? "MY_CONVERSATION_REGION";
1314

1415
// The ID of the Conversation Application to send the message from
15-
var appId = "CONVERSATION_APP_ID";
16-
// The recipient's WhatsApp phone number in E.164 format (e.g. "+15551234567")
17-
var whatsAppPhoneNumber = "RECIPIENT_CONTACT_ID";
16+
const string conversationAppId = "CONVERSATION_APP_ID";
17+
// The recipient's WhatsApp phone number
18+
const string whatsAppPhoneNumber = "RECIPIENT_CONTACT_ID";
1819

1920
var client = new SinchClient(new SinchClientConfiguration
2021
{
@@ -38,8 +39,6 @@
3839
{
3940
Message = new OrderDetails
4041
{
41-
Body = new WhatsAppInteractiveBody { Text = "Here is your order summary." },
42-
Footer = new WhatsAppInteractiveFooter { Text = "Thank you for your purchase!" },
4342
Payment = new OrderDetailsPayment
4443
{
4544
Type = OrderDetailsPayment.TypeEnum.Br,
@@ -76,7 +75,7 @@
7675

7776
var request = new SendMessageRequest
7877
{
79-
AppId = appId,
78+
AppId = conversationAppId,
8079
Recipient = new Identified
8180
{
8281
IdentifiedBy = new IdentifiedBy
@@ -94,8 +93,8 @@
9493
Message = appMessage
9594
};
9695

97-
Console.WriteLine($"Sending ORDER_DETAILS payment message to '{whatsAppPhoneNumber}'");
96+
Console.WriteLine($"Sending payment message to '{whatsAppPhoneNumber}'");
9897

9998
var response = await client.Conversation.Messages.Send(request);
10099

101-
Console.WriteLine($"Message sent. Message ID: {response.MessageId}");
100+
Console.WriteLine($"Response: {response.ToPrettyString()}");

examples/snippets/conversation/messages/SendOrderDetailsPaymentButtons/SendOrderDetailsPaymentButtons.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net8.0</TargetFramework>
5+
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
88
</PropertyGroup>

0 commit comments

Comments
 (0)