A C# SDK for Ytel phone services
NOTE: This is package is currently in development. Until a stable release, it is possible that any updates might include breaking changes.
- Retrieving available phone numbers
- Purchasing a phone number
- Releasing a phone number
- Getting phone numbers owned by Ytel account
- Make call
- Make group call
- InboundXML
-
Register a long-lived bearer token and supply it to the SDK in startup
From your dashboard, navigate to Settings -> API Tokens -> Create Token
builder.Services.AddYtel(options => { options.ApiToken = ytelConfig.ApiToken; });
-
Inject it and use it!
public class PhoneNumberController : ControllerBase { private readonly YtelClient _ytelClient; public PhoneNumberController(YtelClient ytelClient) { _ytelClient = ytelClient; } [HttpGet("/available")] public async Task<ActionResult<YtelApiResponse<GetAvailableNumbersOutput>>> GetAvailablePhoneNumbers( [FromQuery] GetAvailableNumbersInput input) { var phoneNumbers = await _ytelClient.Numbers.GetAvailableNumbersAsync(input); return Ok(phoneNumbers); } }
To run the solution with the included Ytel.Example.Api project,
register your Ytel API token in dotnet secret manager
with the name ApiToken