Επεξεργασία

Κοινή χρήση μέσω


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 may 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.

Diagram showing Azure Event Grid's event model.

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:

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",
}

Next steps