Skip to content

Commit 965a149

Browse files
authored
Merge pull request #218426 from anmolbohra97/main
Adding ACSEvents Documentation
2 parents c917a49 + 9caa226 commit 965a149

10 files changed

+202
-0
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
title: Quickstart - Handle EMAIL and delivery report events
3+
titleSuffix: Azure Communication Services
4+
description: "In this quickstart, you'll learn how to handle Azure Communication Services events. See how to create, receive, and subscribe to Email delivery report and Email engagement tracking events."
5+
author: anmolbohra
6+
manager: komivi.agbakpem
7+
services: azure-communication-services
8+
ms.author: anmolbohra
9+
ms.date: 07/09/2022
10+
ms.topic: quickstart
11+
ms.service: azure-communication-services
12+
ms.subservice: email
13+
---
14+
# Quickstart: Handle Email events
15+
16+
Get started with Azure Communication Services by using Azure Event Grid to handle Communication Services Email events. After subscribing to Email events such as delivery reports and engagement reports, you generate and receive these events. Completing this quickstart incurs a small cost of a few USD cents or less in your Azure account.
17+
18+
[!INCLUDE [Public Preview Notice](../../includes/public-preview-include.md)]
19+
20+
## Prerequisites
21+
22+
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
23+
- A Communication Services resource. For detailed information, see [Create an Azure Communication Services resource](../create-communication-resource.md).
24+
- An Email resource with a provisioned domain. [Create an Email Resource](../email/create-email-communication-resource.md).
25+
26+
## About Event Grid
27+
28+
[Event Grid](../../../event-grid/overview.md) is a cloud-based eventing service. In this article, you'll learn how to subscribe to [communication service events](../../../event-grid/event-schema-communication-services.md), and trigger an event to view the result. Typically, you send events to an endpoint that processes the event data and takes actions. In this article, we'll send the events to a web app that collects and displays the messages.
29+
30+
## Set up the environment
31+
32+
To set up the environment that we'll use to generate and receive events, take the steps in the following sections.
33+
34+
### Register an Event Grid resource provider
35+
36+
If you haven't previously used Event Grid in your Azure subscription, you might need to register your Event Grid resource provider. To register the provider, follow these steps:
37+
38+
1. Go to the Azure portal.
39+
1. On the left menu, select **Subscriptions**.
40+
1. Select the subscription that you use for Event Grid.
41+
1. On the left menu, under **Settings**, select **Resource providers**.
42+
1. Find **Microsoft.EventGrid**.
43+
1. If your resource provider isn't registered, select **Register**.
44+
45+
It might take a moment for the registration to finish. Select **Refresh** to update the status. When **Registered** appears under **Status**, you're ready to continue.
46+
47+
### Deploy the Event Grid viewer
48+
49+
For this quickstart, we'll use an Event Grid viewer to view events in near-real time. The viewer provides the user with the experience of a real-time feed. Also, the payload of each event should be available for inspection.
50+
51+
To set up the viewer, follow the steps in [Azure Event Grid Viewer](/samples/azure-samples/azure-event-grid-viewer/azure-event-grid-viewer/).
52+
53+
## Subscribe to Email events by using web hooks
54+
55+
You can subscribe to specific events to provide Event Grid with information about where to send the events that you want to track.
56+
57+
1. In the portal, go to the Communication Services resource that you created.
58+
59+
1. Inside the Communication Services resource, on the left menu of the **Communication Services** page, select **Events**.
60+
61+
1. Select **Add Event Subscription**.
62+
63+
:::image type="content" source="./media/handle-email-events/select-events.png" alt-text="Screenshot that shows the Events page of an Azure Communication Services resource. The Event Subscription button is called out.":::
64+
65+
1. On the **Create Event Subscription** page, enter a **name** for the event subscription.
66+
67+
1. Under **Event Types**, select the events that you'd like to subscribe to. For Email, you can choose `Email Delivery Report Received` and `Email Engagement Tracking Report Received`.
68+
69+
1. If you're prompted to provide a **System Topic Name**, feel free to provide a unique string. This field has no impact on your experience and is used for internal telemetry purposes.
70+
71+
:::image type="content" source="./media/handle-email-events/select-events-create-eventsub.png" alt-text="Screenshot that shows the Create Event Subscription dialog. Under Event Types, Email Delivery Report Received and Email Engagement Tracking Report Received are selected.":::
72+
73+
1. For **Endpoint type**, select **Web Hook**.
74+
75+
:::image type="content" source="./media/handle-email-events/select-events-create-linkwebhook.png" alt-text="Screenshot that shows a detail of the Create Event Subscription dialog. In the Endpoint Type list, Web Hook is selected.":::
76+
77+
1. For **Endpoint**, select **Select an endpoint**, and then enter the URL of your web app.
78+
79+
In this case, we'll use the URL from the [Event Grid viewer](/samples/azure-samples/azure-event-grid-viewer/azure-event-grid-viewer/) that we set up earlier in the quickstart. The URL for the sample has this format: `https://{{site-name}}.azurewebsites.net/api/updates`
80+
81+
1. Select **Confirm Selection**.
82+
83+
:::image type="content" source="./media/handle-email-events/select-events-create-selectwebhook-epadd.png" alt-text="Screenshot that shows the Select Web Hook dialog. The Subscriber Endpoint box contains a URL, and a Confirm Selection button is visible.":::
84+
85+
## View Email events
86+
87+
To generate and receive Email events, take the steps in the following sections.
88+
89+
### Trigger Email events
90+
91+
To view event triggers, we need to generate some events. To trigger an event, [send email](../email/send-email.md) using the Email domain resource attached to the Communication Services resource.
92+
93+
- `Email Delivery Report Received` events are generated when the Email status is in terminal state, i.e. Delivered, Failed, FilteredSpam, Quarantined.
94+
- `Email Engagement Tracking Report Received` events are generated when the email sent is either opened or a link within the email is clicked. To trigger an event, you need to turn on the `User Interaction Tracking` option on the Email domain resource
95+
96+
Check out the full list of [events that Communication Services supports](../../../event-grid/event-schema-communication-services.md).
97+
98+
### Receive Email events
99+
100+
After you generate an event, you'll notice that `Email Delivery Report Received` and `Email Engagement Tracking Report Received` events are sent to your endpoint. These events show up in the [Event Grid viewer](/samples/azure-samples/azure-event-grid-viewer/azure-event-grid-viewer/) that we set up at the beginning of this quickstart. Select the eye icon next to the event to see the entire payload. Events should look similar to the following data:
101+
102+
:::image type="content" source="./media/handle-email-events/email-delivery-report-received.png" alt-text="Screenshot of the Azure Event Grid viewer that shows the Event Grid schema for an EMAIL delivery report received event.":::
103+
104+
:::image type="content" source="./media/handle-email-events/email-engagementtracking-report-received.png" alt-text="Screenshot of the Azure Event Grid viewer that shows the Event Grid schema for an EMAIL engagement tracking report event.":::
105+
106+
Learn more about the [event schemas and other eventing concepts](../../../event-grid/event-schema-communication-services.md).
107+
108+
## Clean up resources
109+
110+
If you want to clean up and remove a Communication Services subscription, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with it. Learn more about [cleaning up resources](../create-communication-resource.md#clean-up-resources).
111+
112+
## Next steps
113+
114+
In this quickstart, you learned how to consume Email events. You can receive Email events by creating an Event Grid subscription.
115+
116+
> [!div class="nextstepaction"]
117+
> [Send Email](../email/send-email.md)
118+
119+
You might also want to:
120+
121+
- [Learn about event handling concepts](../../../event-grid/event-schema-communication-services.md)
122+
- [Learn about Event Grid](../../../event-grid/overview.md)
33.5 KB
Loading
Loading
103 KB
Loading
11.6 KB
Loading
Loading
140 KB
Loading

articles/communication-services/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ items:
4545
href: quickstarts/email/connect-email-communication-resource.md
4646
- name: Send an Email
4747
href: quickstarts/email/send-email.md
48+
- name: Handle Email events
49+
href: quickstarts/email/handle-email-events.md
4850
- name: Send an Email in Azure Logic Apps
4951
href: quickstarts/email/logic-app.md
5052
- name: Telephony and phone numbers
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: Azure Communication Services - Email events
3+
description: This article describes how to use Azure Communication Services as an Event Grid event source for Email Events.
4+
ms.topic: conceptual
5+
ms.date: 09/30/2022
6+
ms.author: anmolbohra
7+
---
8+
9+
# Azure Communication Services - Email events
10+
11+
This article provides the properties and schema for communication services telephony and SMS events. For an introduction to event schemas, see [Azure Event Grid event schema](event-schema.md).
12+
13+
## Events types
14+
15+
Azure Communication Services emits the following telephony and SMS event types:
16+
17+
| Event type | Description |
18+
| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
19+
| Microsoft.Communication.EmailDeliveryReportReceived | Published when a delivery report is received for an Email sent by the Communication Service. |
20+
| Microsoft.Communication.EmailEngagementTrackingReportReceived | Published when the Email sent is either opened or the link, if applicable is clicked. |
21+
22+
## Event responses
23+
24+
When an event is triggered, the Event Grid service sends data about that event to subscribing endpoints.
25+
26+
This section contains an example of what that data would look like for each event.
27+
28+
### Microsoft.Communication.EmailDeliveryReportReceived event
29+
30+
```json
31+
[{
32+
"id": "00000000-0000-0000-0000-000000000000",
33+
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/microsoft.communication/communicationservices/{communication-services-resource-name}",
34+
"subject": "sender/[email protected]/message/00000000-0000-0000-0000-000000000000",
35+
"data": {
36+
"sender": "[email protected]",
37+
"recipient": "[email protected]",
38+
"messageId": "00000000-0000-0000-0000-000000000000",
39+
"status": "Delivered",
40+
"DeliveryStatusDetails": "No error.",
41+
"ReceivedTimestamp": "2020-09-18T00:22:20.2855749Z",
42+
},
43+
"eventType": "Microsoft.Communication.EmailDeliveryReportReceived",
44+
"dataVersion": "1.0",
45+
"metadataVersion": "1",
46+
"eventTime": "2020-09-18T00:22:20Z"
47+
}]
48+
```
49+
50+
> [!NOTE]
51+
> Possible values for `Status` are `Delivered`, `Expanded` and `Failed`.
52+
53+
### Microsoft.Communication.EmailEngagementTrackingReportReceived event
54+
55+
```json
56+
[{
57+
"id": "00000000-0000-0000-0000-000000000000",
58+
"topic": "/subscriptions/{subscription-id}/resourceGroups/{group-name}/providers/microsoft.communication/communicationservices/{communication-services-resource-name}",
59+
"subject": "sender/[email protected]/message/00000000-0000-0000-0000-000000000000",
60+
"data": {
61+
"sender": "[email protected]",
62+
"messageId": "00000000-0000-0000-0000-000000000000",
63+
"userActionTimeStamp": "2022-09-06T22:34:52.1303595+00:00",
64+
"engagementContext": "",
65+
"userAgent": "",
66+
"engagementType": "view"
67+
},
68+
"eventType": "Microsoft.Communication.EmailEngagementTrackingReportReceived",
69+
"dataVersion": "1.0",
70+
"metadataVersion": "1",
71+
"eventTime": "2022-09-06T22:34:52.1303612Z"
72+
}]
73+
```
74+
75+
> [!NOTE]
76+
> Possible values for `engagementType` are `View`, and `Click`. When the `engagementType` is `Click`, `engagementContext` is the link in the Email sent which was clicked.

articles/event-grid/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ items:
137137
href: communication-services-voice-video-events.md
138138
- name: Presence Events
139139
href: communication-services-presence-events.md
140+
- name: Email Events
141+
href: communication-services-email-events.md
140142
- name: Azure Container Registry
141143
href: event-schema-container-registry.md
142144
- name: Azure Event Hubs

0 commit comments

Comments
 (0)