Back to Azure Sdk For

Azure Communication Short Code client library for .NET

sdk/communication/Azure.Communication.ShortCodes/README.md

2019-05-16T16-524.3 KB
Original Source

Azure Communication Short Code client library for .NET

The phone numbers library provides capabilities for short codes administration.

Getting started

Install the package

Install the Azure Communication Server Calling client library for .NET with NuGet:

PowerShell
dotnet add package Azure.Communication.ShortCodes --prerelease

Prerequisites

You need an Azure subscription and a Communication Service Resource to use this package.

To create a new Communication Service, you can use the Azure Portal, the Azure PowerShell, or the .NET management client library.

Authenticate the client

SMS clients can be authenticated using the connection string acquired from an Azure Communication Resource in the Azure Portal.

Key concepts

The short codes package exposes the ShortCodesClient which provides methods to manage short codes.

Short Code types

Short Codes come in two types; shortCode and alphaId. ShortCode = 5 digit number | alphaId = alphanumeric 5 digit combination.

Short Codes

Short codes are a type of number that are available to enterprise customers. They come in the form of a 5 or 6 digit number and can be used to send sms similar to how a toll-free or geographic number is used. In order to acquire a short code it is necessary to submit an application, or program brief.

Program Briefs

A program brief tracks the application for a short code and contains all the information necessary to process the application as well as information on the status of the application and any updates that may be needed. It can take 8-12 weeks for a program brief to be approved and a short code to be issued once the program brief is submitted.

C#
// Get a connection string to our Azure Communication resource.
var connectionString = "<connection_string>";
var client = new ShortCodesClient(connectionString);

Examples

Getting the list of short codes for the current resource

C#
var pageable = client.GetShortCodesAsync();
await foreach (var shortCode in pageable)
{
    Console.WriteLine($"Short Code Number: {shortCode.Number}");
}

Troubleshooting

A RequestFailedException is thrown as a service response for any unsuccessful requests. The exception contains information about what response code was returned from the service.

<!-- LINKS -->

Next steps

Read more about Short Codes in Azure Communication Services.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.microsoft.com.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

<!-- LINKS -->