But you can also write your own SMS broker implementation. To do this, you'll need to declare a new extension point in the plugin.xml file of a plugin Ametys . If necessary, you'll need to create a new plugin, then follow the instructions on the Architecture page of plugin Ametys .
Step 1: In a plugin.xml file, start by declaring your extension point and any configuration parameters required for sending SMS, as in the example below:
Oops!
Copy to clipboard failed. Open the code and copy it manually.
Step 2: Then write the class com.mycompany.cms.sms.broker.MyBroker :
Oops!
Copy to clipboard failed. Open the code and copy it manually.
public class MyBroker extends LoggerBroker
{
@Override
public void send(Set<String> phoneNumbersList, String message, String listId) throws Exception
{
super.send(phoneNumbersList, message, listId);
// Do it: send SMS to all the phones in the list
}
@Override
public String getPhoneNumberFromStopRequest() throws Exception
{
// Do it ...
}
}
public class MyBroker extends LoggerBroker
{
@Override
public void send(Set<String> phoneNumbersList, String message, String listId) throws Exception
{
super.send(phoneNumbersList, message, listId);
// Do it: send SMS to all the phones in the list
}
@Override
public String getPhoneNumberFromStopRequest() throws Exception
{
// Do it ...
}
}
public class MyBroker extends LoggerBroker
{
@Override
public void send(Set<String> phoneNumbersList, String message, String listId) throws Exception
{
super.send(phoneNumbersList, message, listId);
// Do it: send SMS to all the phones in the list
}
@Override
public String getPhoneNumberFromStopRequest() throws Exception
{
// Do it ...
}
}
The method send is responsible for sending mail. For example, use your provider's web service to send SMS messages.
The method getPhoneNumberFromStopRequest is responsible for extracting the telephone number wishing to unsubscribe from the service from the HTTP request sent by the provider (broker). For example, for Etoile Diesethe number is contained in the query parameter "num" : http://<monsite.com>/_plugins/sms/stop-sms?num=336xxxxxxxx&txt=STOP
Step 3: Finally, select your broker in the WEB-INF/param/runtime.xml
Oops!
Copy to clipboard failed. Open the code and copy it manually.