Piwik\Plugins\MobileMessaging\
The SMSProvider abstract class is used as a base class for SMS provider implementations.
The abstract class defines the following methods:
getId()
— Get the ID of the SMS Provider.getDescription()
— Get a description about the SMS Provider.verifyCredential()
— Verify the SMS API credential.getCreditLeft()
— Get the amount of remaining credits.sendSMS()
— Actually send the given text message.getCredentialFields()
— Defines the fields that needs to be filled up to provide credentialsisAvailable()
— Defines whether the SMS Provider is available.getId()
Get the ID of the SMS Provider. Eg 'Clockwork' or 'FreeMobile'
string
value.getDescription()
Get a description about the SMS Provider. For example who the SMS Provider is, instructions how the API Key needs to be set, and more. You may return HTML here for better formatting.
string
value.verifyCredential()
Verify the SMS API credential.
It accepts the following parameter(s):
$credentials
(array
) —
contains credentials (eg. like API key, user name, ...)Returns: bool
—
true if credentials are valid, false otherwise
getCreditLeft()
Get the amount of remaining credits.
It accepts the following parameter(s):
$credentials
(array
) —
contains credentials (eg. like API key, user name, ...)Returns: string
—
remaining credits
sendSMS()
Actually send the given text message. This method should only send the text message, it should not trigger any notifications etc.
It accepts the following parameter(s):
$credentials
(array
) —
contains credentials (eg. like API key, user name, ...)$smsText
(string
) —
$phoneNumber
(string
) —
$from
(string
) —
Returns: bool
—
true
getCredentialFields()
Defines the fields that needs to be filled up to provide credentials
Example: array ( array( 'type' => 'text', 'name' => 'apiKey', 'title' => 'Translation_Key_To_Use' ) )
array
value.isAvailable()
Defines whether the SMS Provider is available. If a certain provider should be used only be a limited range of users you can restrict the provider here. For example there is a Development SMS Provider that is only available when the development is actually enabled. You could also create a SMS Provider that is only available to Super Users etc. Usually this method does not have to be implemented by a SMS Provider.
bool
value.