Azure Communication Services as an Azure Event Grid source
Azure Communication Services integrates with Azure Event Grid to deliver real-time event notifications in a reliable, scalable, and secure manner. The purpose of this article is to help you configure your applications to listen to Communication Services events. For example, you might want to update a database, create a work item and deliver a push notification whenever an SMS message is received by a phone number associated with your Communication Services resource.
Azure Event Grid is a fully managed event routing service, which uses a publish-subscribe model. Event Grid has built-in support for Azure services like Azure Functions and Azure Logic Apps. It can deliver event alerts to non-Azure services using webhooks. For a complete list of the event handlers that Event Grid supports, see An introduction to Azure Event Grid.
Note
To learn more about how data residency relates to event handling, visit the Data Residency conceptual documentation
Events types
Event Grid uses event subscriptions to route event messages to subscribers.
Azure Communication Services emits the following event types:
- Chat Events
- Telephony and SMS Events
- Voice and Video Calling Events
- Presence Events
- Email Events
- Job Router Events
- Advanced Messaging Events
You can use the Azure portal or Azure CLI to subscribe to events emitted by your Communication Services resource.
Event subjects
The subject
field of all Communication Services events identifies the user, phone number, or entity that is targeted by the event. Common prefixes are used to allow simple Event Grid filtering.
Subject Prefix | Communication Service Entity |
---|---|
phonenumber/ |
PSTN phone number |
user/ |
Communication Services User |
thread/ |
Chat thread. |
The following example shows a filter for all SMS messages and delivery reports sent to all 555 area code phone numbers owned by a Communication Services resource:
"filter": {
"includedEventTypes": [
"Microsoft.Communication.SMSReceived",
"Microsoft.Communication.SMSDeliveryReportReceived"
],
"subjectBeginsWith": "phonenumber/1555",
}
Related content
- For an introduction to Azure Event Grid, see What is Event Grid?
- For an introduction to Azure Event Grid Concepts, see Concepts in Event Grid?
- For an introduction to Azure Event Grid SystemTopics, see System topics in Azure Event Grid?