You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Start sending messages between a business and a WhatsApp user
17
+
18
+
Conversations between a WhatsApp Business Account and a WhatsApp user can be initiated in one of two ways:
19
+
- The business sends a template message to the WhatsApp user.
20
+
- The WhatsApp user sends any message to the business number.
21
+
22
+
Regardless of how the conversation was started, **a business can only send template messages until the user sends a message to the business.** Only after the user sends a message to the business, the business is allowed to send text or media messages to the user during the active conversation. Once the 24 hour conversation window expires, the conversation must be reinitiated. To learn more about conversations, see the definition at [WhatsApp Business Platform](https://developers.facebook.com/docs/whatsapp/pricing#conversations).
15
23
16
24
### Authenticate the client
17
25
@@ -137,60 +145,3 @@ Example:
137
145
List<String> recipientList =newArrayList<>();
138
146
recipientList.add("+14255550199");
139
147
```
140
-
141
-
### Start sending messages between a business and a WhatsApp user
142
-
143
-
Conversations between a WhatsApp Business Account and a WhatsApp user can be initiated in one of two ways:
144
-
- The business sends a template message to the WhatsApp user.
145
-
- The WhatsApp user sends any message to the business number.
146
-
147
-
Regardless of how the conversation was started, **a business can only send template messages until the user sends a message to the business.** Only after the user sends a message to the business, the business is allowed to send text or media messages to the user during the active conversation. Once the 24 hour conversation window expires, the conversation must be reinitiated. To learn more about conversations, see the definition at [WhatsApp Business Platform](https://developers.facebook.com/docs/whatsapp/pricing#conversations).
148
-
149
-
#### (Option 1) Initiate conversation from business - Send a template message
150
-
Initiate a conversation by sending a template message.
151
-
152
-
First, create a MessageTemplate using the values for a template.
153
-
> [!NOTE]
154
-
> To check which templates you have available, see the instructions at [List templates](../../../../concepts/advanced-messaging/whatsapp/template-messages.md#list-templates).
155
-
> If you don't have a template to use, proceed to [Option 2](#option-2-initiate-conversation-from-user).
156
-
157
-
Here's MessageTemplate creation using a default template, `sample_template`.
158
-
If `sample_template` isn't available to you, skip to [Option 2](#option-2-initiate-conversation-from-user). For advanced users, see the page [Templates](../../../../concepts/advanced-messaging/whatsapp/template-messages.md) to understand how to send a different template with Option 1.
159
-
160
-
Messages SDK allows Contoso to send templated WhatsApp messages to WhatsApp users. To send template messages below details are required:
for (MessageReceipt messageReceipt : templateMessageResult.getReceipts()) {
182
-
System.out.println("Message sent to:"+ messageReceipt.getTo() +" and message id:"+ messageReceipt.getMessageId());
183
-
}
184
-
```
185
-
186
-
Now, the user needs to respond to the template message. From the WhatsApp user account, reply to the template message received from the WhatsApp Business Account. The content of the message is irrelevant for this scenario.
187
-
188
-
> [!IMPORTANT]
189
-
> The recipient must respond to the template message to initiate the conversation before text or media message can be delivered to the recipient.
190
-
191
-
#### (Option 2) Initiate conversation from user
192
-
193
-
The other option to initiate a conversation between a WhatsApp Business Account and a WhatsApp user is to have the user initiate the conversation.
194
-
To do so, from your personal WhatsApp account, send a message to your business number (Sender ID).
195
-
196
-
:::image type="content" source="../media/get-started/user-initiated-conversation.png" lightbox="" alt-text="A WhatsApp conversation viewed on the web showing a user message sent to the WhatsApp Business Account number.":::
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/advanced-messaging/whatsapp/includes/get-started/messages-get-started-java.md
+20-30Lines changed: 20 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,45 +24,20 @@ To set up an environment for sending messages, complete the steps in the followi
24
24
25
25
[!INCLUDE [Setting up for Java Application](../java-application-setup.md)]
26
26
27
-
## Object model
28
-
29
-
The following classes and interfaces handle some of the major features of the Azure Communication Services Advance Messaging SDK for Java.
30
-
31
-
| Class Name | Description |
32
-
| --- |--- |
33
-
|`NotificationMessagesClientBuilder`| Creates the Notification Messages Client. You provide it with an endpoint and a credential. |
34
-
|`NotificationMessagesClient`| Needed to send WhatsApp messages and download media files. |
35
-
|`NotificationMessagesAsyncClient`| Needed to send WhatsApp messages and download media files asynchronously. |
36
-
|`SendMessageResult`| Contains the result from the Advance Messaging service for send notification message. |
37
-
|`MessageTemplateClientBuilder`| Creates the Message Template Client. You provide it with an endpoint and a credential. |
38
-
|`MessageTemplateClient`| Needed to get the list of WhatsApp templates. |
39
-
|`MessageTemplateAsyncClient`| Needed to get the list of WhatsApp templates asynchronously. |
40
-
41
-
> [!NOTE]
42
-
> For more information, see the Azure SDK for Java reference [com.azure.communication.messages](/java/api/com.azure.communication.messages)
43
-
44
-
## Common configuration
45
-
46
-
Complete these steps to add required code snippets to the `messages-quickstart.py` python program.
27
+
## Code examples
47
28
29
+
Follow these steps to add required code snippets to the main function of your `App.java` file.
30
+
-[Start sending messages between a business and a WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
48
31
-[Authenticate the client](#authenticate-the-client).
-[Start sending messages between a business and a WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
52
-
53
-
[!INCLUDE [Common setting for using Advanced Messages SDK](../common-setting-java.md)]
54
-
55
-
## Code examples
56
-
57
-
Follow these steps to add required code snippets to the main function of your `App.java` file.
58
34
-[Send a text message to a WhatsApp user](#send-a-text-message-to-a-whatsapp-user)
59
35
-[Send an image media message to a WhatsApp user](#send-an-image-media-message-to-a-whatsapp-user)
60
36
-[Send a document media message to a WhatsApp user](#send-a-document-media-message-to-a-whatsapp-user)
61
37
-[Send an audio media message to a WhatsApp user](#send-an-audio-media-message-to-a-whatsapp-user)
62
38
-[Send a video media message to a WhatsApp user](#send-a-video-media-message-to-a-whatsapp-user)
63
39
64
-
> [!IMPORTANT]
65
-
> To send a text message to a WhatsApp user, the WhatsApp user must first send a message to the WhatsApp Business Account. For more information, see [Start sending messages between business and WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
40
+
[!INCLUDE [Common setting for using Advanced Messages SDK](../common-setting-java.md)]
66
41
67
42
### Send a text message to a WhatsApp user
68
43
@@ -73,6 +48,9 @@ Messages SDK allows Contoso to send text WhatsApp messages, which initiated What
73
48
74
49
In this example, we reply to the WhatsApp user with the text `"Thanks for your feedback.\n From Notification Messaging SDK."`
75
50
51
+
> [!IMPORTANT]
52
+
> To send a text message to a WhatsApp user, the WhatsApp user must first send a message to the WhatsApp Business Account. For more information, see [Start sending messages between business and WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
53
+
76
54
Assemble and send the text message:
77
55
78
56
```java
@@ -98,6 +76,9 @@ The Messages SDK enables Contoso to send media (image, video, audio, or document
98
76
> [!IMPORTANT]
99
77
> As of SDK version 1.1.0, `MediaNotificationContent` is being deprecated for images. We encourage you to use `ImageNotificationContent` to send images. Explore other content-specific classes for other media types like `DocumentNotificationContent`, `VideoNotificationContent`, and `AudioNotificationContent`.
100
78
79
+
> [!IMPORTANT]
80
+
> To send a image message to a WhatsApp user, the WhatsApp user must first send a message to the WhatsApp Business Account. For more information, see [Start sending messages between business and WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
81
+
101
82
Assemble and send the image message:
102
83
103
84
```java
@@ -121,6 +102,9 @@ The Messages SDK enables Contoso to send media (image, video, audio, or document
121
102
-[Recipient Phone Number in E16 format](#set-recipient-list).
122
103
- URL of the Video media.
123
104
105
+
> [!IMPORTANT]
106
+
> To send a video message to a WhatsApp user, the WhatsApp user must first send a message to the WhatsApp Business Account. For more information, see [Start sending messages between business and WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
107
+
124
108
Assemble and send the video message:
125
109
126
110
```java
@@ -144,6 +128,9 @@ The Messages SDK enables Contoso to send media (image, video, audio, or document
144
128
-[Recipient Phone Number in E16 format](#set-recipient-list).
145
129
- URL of the Audio media.
146
130
131
+
> [!IMPORTANT]
132
+
> To send a audio message to a WhatsApp user, the WhatsApp user must first send a message to the WhatsApp Business Account. For more information, see [Start sending messages between business and WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
133
+
147
134
Assemble and send the audio message:
148
135
149
136
```java
@@ -167,6 +154,9 @@ The Messages SDK enables Contoso to send media (image, video, audio, or document
167
154
-[Recipient Phone Number in E16 format](#set-recipient-list).
168
155
- URL of the Document media.
169
156
157
+
> [!IMPORTANT]
158
+
> To send a document message to a WhatsApp user, the WhatsApp user must first send a message to the WhatsApp Business Account. For more information, see [Start sending messages between business and WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
159
+
170
160
Assemble and send the document message:
171
161
172
162
```java
@@ -199,4 +189,4 @@ for (MessageReceipt messageReceipt : docMessageResult.getReceipts()) {
199
189
200
190
## Full sample code
201
191
202
-
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure/azure-sdk-for-java/tree/d668cb44f64d303e71d2ee72a8b0382896aa09d5/sdk/communication/azure-communication-messages/src/samples/java/com/azure/communication/messages).
192
+
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/communication/azure-communication-messages/src/samples/java/com/azure/communication/messages).
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/advanced-messaging/whatsapp/includes/java-application-setup.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,6 @@ Open the `pom.xml` file in your text editor. Add the following dependency elemen
The following classes and interfaces handle some of the major features of the Azure Communication Services Advance Messaging SDK for Java.
59
+
60
+
| Class Name | Description |
61
+
| --- |--- |
62
+
|`NotificationMessagesClientBuilder`| Creates the Notification Messages Client. You provide it with an endpoint and a credential. |
63
+
|`NotificationMessagesClient`| Needed to send WhatsApp messages and download media files. |
64
+
|`NotificationMessagesAsyncClient`| Needed to send WhatsApp messages and download media files asynchronously. |
65
+
|`SendMessageResult`| Contains the result from the Advance Messaging service for send notification message. |
66
+
|`MessageTemplateClientBuilder`| Creates the Message Template Client. You provide it with an endpoint and a credential. |
67
+
|`MessageTemplateClient`| Needed to get the list of WhatsApp templates. |
68
+
|`MessageTemplateAsyncClient`| Needed to get the list of WhatsApp templates asynchronously. |
69
+
70
+
> [!NOTE]
71
+
> For more information, see the Azure SDK for Java reference [com.azure.communication.messages](https://learn.microsoft.com/en-us/java/api/overview/azure/communication-messages-readme?view=azure-java-stable)
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/advanced-messaging/whatsapp/includes/reactions/messages-quickstart-reaction-messages-java.md
+63-1Lines changed: 63 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,68 @@ ms.author: shamkh
13
13
14
14
## Prerequisites
15
15
16
-
## Setting up
16
+
-[WhatsApp Business Account registered with your Azure Communication Services resource](../../connect-whatsapp-business-account.md).
17
+
- Active WhatsApp phone number to receive messages.
18
+
-[Java Development Kit (JDK)](/java/azure/jdk/) version 8 or later.
-[Recipient Phone Number in E16 format](#set-recipient-list).
43
+
- Reaction message content.
44
+
45
+
> [!IMPORTANT]
46
+
> To send a reaction to user message, the WhatsApp user must first send a message to the WhatsApp Business Account. For more information, see [Start sending messages between business and WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/communication/azure-communication-messages/src/samples/java/com/azure/communication/messages).
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/advanced-messaging/whatsapp/includes/stickers/messages-quickstart-sticker-messages-java.md
+66-4Lines changed: 66 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,79 @@
2
2
title: Include file
3
3
description: Include file
4
4
services: azure-communication-services
5
-
author: shamkh
5
+
author: arifibrahim4
6
6
ms.service: azure-communication-services
7
7
ms.subservice: advanced-messaging
8
-
ms.date: 12/15/2024
8
+
ms.date: 1/27/2025
9
9
ms.topic: include
10
10
ms.custom: include file
11
-
ms.author: shamkh
11
+
ms.author: armohamed
12
12
---
13
13
14
14
## Prerequisites
15
15
16
-
## Setting up
16
+
-[WhatsApp Business Account registered with your Azure Communication Services resource](../../connect-whatsapp-business-account.md).
17
+
- Active WhatsApp phone number to receive messages.
18
+
-[Java Development Kit (JDK)](/java/azure/jdk/) version 8 or later.
-[Recipient Phone Number in E16 format](#set-recipient-list).
43
+
- Sticker message content.
44
+
45
+
> [!IMPORTANT]
46
+
> To send a sticker message to user, the WhatsApp user must first send a message to the WhatsApp Business Account. For more information, see [Start sending messages between business and WhatsApp user](#start-sending-messages-between-a-business-and-a-whatsapp-user).
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/communication/azure-communication-messages/src/samples/java/com/azure/communication/messages).
0 commit comments