|
4 | 4 | using Sinch.Conversation.Messages.Message; |
5 | 5 | using Sinch.Conversation.Messages.Message.ChannelSpecificMessages.WhatsApp; |
6 | 6 | using Sinch.Conversation.Messages.Send; |
| 7 | +using Sinch.Core; |
7 | 8 | using Sinch.Snippets.Shared; |
8 | 9 |
|
9 | 10 | var projectId = ConfigurationHelper.GetProjectId() ?? "MY_PROJECT_ID"; |
|
12 | 13 | var conversationRegion = ConfigurationHelper.GetConversationRegion() ?? "MY_CONVERSATION_REGION"; |
13 | 14 |
|
14 | 15 | // 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"; |
18 | 19 |
|
19 | 20 | var client = new SinchClient(new SinchClientConfiguration |
20 | 21 | { |
|
38 | 39 | { |
39 | 40 | Message = new OrderDetails |
40 | 41 | { |
41 | | - Body = new WhatsAppInteractiveBody { Text = "Here is your order summary." }, |
42 | | - Footer = new WhatsAppInteractiveFooter { Text = "Thank you for your purchase!" }, |
43 | 42 | Payment = new OrderDetailsPayment |
44 | 43 | { |
45 | 44 | Type = OrderDetailsPayment.TypeEnum.Br, |
|
76 | 75 |
|
77 | 76 | var request = new SendMessageRequest |
78 | 77 | { |
79 | | - AppId = appId, |
| 78 | + AppId = conversationAppId, |
80 | 79 | Recipient = new Identified |
81 | 80 | { |
82 | 81 | IdentifiedBy = new IdentifiedBy |
|
94 | 93 | Message = appMessage |
95 | 94 | }; |
96 | 95 |
|
97 | | -Console.WriteLine($"Sending ORDER_DETAILS payment message to '{whatsAppPhoneNumber}'"); |
| 96 | +Console.WriteLine($"Sending payment message to '{whatsAppPhoneNumber}'"); |
98 | 97 |
|
99 | 98 | var response = await client.Conversation.Messages.Send(request); |
100 | 99 |
|
101 | | -Console.WriteLine($"Message sent. Message ID: {response.MessageId}"); |
| 100 | +Console.WriteLine($"Response: {response.ToPrettyString()}"); |
0 commit comments