Provider Script Documentation

Introduction

Provider scripts are C# files for SMS service providers.

Required Interface Implementation

Your provider script must inherit from the SmsClient class and implement the following interface:

public interface ISmsClient 
{
    Task<SmsBalance> GetBalanceAsync();

    Task<List<SmsCountry>> GetCountriesAsync();
    Task<List<SmsService>> GetServicesAsync();    
    Task GetPricesAsync(List<SmsService> services, List<SmsCountry> countries);

    Task<SmsPhone> GetPhoneNumberAsync(SmsCountry country, SmsService service);
    Task<SmsCode> GetSmsAsync(SmsPhone phone, SmsCountry country, SmsService service);
    
    Task<SmsResponse> BanNumberAsync(SmsPhone phone, SmsCountry country, SmsService service, string reason = null);
    Task<SmsResponse> CancelNumberAsync(SmsPhone phone, SmsCountry country, SmsService service, string reason = null);
    Task<SmsResponse> SuccessNumberAsync(SmsPhone phone, SmsCountry country, SmsService service);
}

Model Definitions

SmsBalance
public class SmsBalance
{
    public decimal? Balance { get; set; }
    public string Currency { get; set; }
    public string CurrencySymbol { get; set; }
}
SmsService
public class SmsService
{
    public string Id { get; set; }
    public string Name { get; set; }

    public decimal? Price { get; set; }
    public string CurrencySymbol { get; set; }
    public string Currency { get; set; }
}
SmsCountry
public class SmsCountry
{
    public string Id { get; set; }
    public string Code { get; set; }
    public string Name { get; set; }

    public decimal? Price { get; set; }
    public List<decimal?> PriceList { get; set; }
    
    public string CurrencySymbol { get; set; }
    public string Currency { get; set; }
}
SmsPhone
public class SmsPhone
{
    public string Id { get; set; }
    public string Number { get; set; }
    public string Error { get; set; }
}
SmsCode
public class SmsCode
{
    public string Code { get; set; }
    
    public string Message { get; set; }
    public bool Retry { get; set; } = true;
}
SmsResponse
public class SmsResponse
{
    public bool Success { get; set; }
    public string Message { get; set; }
    
    public string Code { get; set; }
}

Provider Configuration

Your provider class must be decorated with the ProviderConfig attribute:

[ProviderConfig(
    Name = "UniqueName",
    DisplayName = "Your Provider Display Name",
    Website = "https://your-provider-website.com",
    BaseUrl = "https://api.your-provider.com",
    Casing = Casing.CamelCase or Casing.SnakeCase,
    Information = "Additional information about your provider"
)]

Examples

You can find examples on the home page.

Submitting Your Script

To submit your script:

  1. Ensure your script follows all requirements
  2. Test your implementation thoroughly
  3. Use the Submit Script form to upload your file
Submit Your Script