Validate Azure Communication Services events
This document shows you how to validate that your Azure Communication Services resource sends events using Azure Event Grid viewer or RequestBin.
Using Azure Event Grid incurs additional costs. For more information, see Azure Event Grid pricing.
- An Azure account with an active subscription. Create an account for free.
- An active Communication Services resource and connection string. Create a Communication Services resource.
- Install Azure CLI.
If you already have an Azure Event Grid viewer deployed or would like to have a more robust viewer in place, you can follow instructions to deploy it. You need the endpoint generated by the Event Grid viewer.
Alternatively, if you want a quick and easy way to validate your events, you can use RequestBin. RequestBin offers two modalities to pick from. If you want to quickly test your events, you can use the public endpoint setup. These public endpoints make event data accessible to anyone with a URL. If you prefer to keep it private, you can create a RequestBin account and create a private endpoint. For more information, see RequestBin public vs private endpoints.
The next steps are the same for both options.
Configure your Azure Communication Services resource to send events to your endpoint
Using Azure CLI, we configure the endpoint we created in the pre-requisites to receive events from your Azure Communication Services resource. You need the resource ID for your Azure Communication Services resource found in the Azure portal.
az eventgrid event-subscription create --name "<<EVENT_SUBSCRIPTION_NAME>>" --endpoint-type webhook --endpoint "<<URL>> " --source-resource-id "<<RESOURCE_ID>>" --included-event-types Microsoft.Communication.SMSReceived
In the command, we only added the
Microsoft.Communication.SMSReceivedevent type. You can add more event types to the command if you would like to receive more events. For a list of all the event types, see Azure Communication Services events.
(Optional, only if using RequestBin) You need to copy the
validationURLon the first event the gets posted to your endpoint. You need to paste that URL on your browser to validate the endpoint. The page should saw 'Webhook successfully validated as a subscription endpoint'.
Now that you've configured your endpoint to receive events, you can use it to view events as they come through.