Enable and configuring the SMS transport
Enabling the Short Message Service (SMS) transport extends cross-channel access by offering mobile device capabilities in WebSphere Commerce. Mobile messaging enhances the shopper's access to information by providing access through their mobile device.
Task info
This task enables and configures the SMS transport in WebSphere Commerce using the Administration Console. The steps involved in this task include:
- Adding an SMS transport to the site, if necessary, using the Administration Console transports.
- Creating and configuring a message type using the Administration Console message types.
- Mapping the message type to a JSP file by editing the struts-config.xml configuration file.
Procedure
- Open the Administration Console and select Site or Store, on the Administration Console Site/Store Selection page.
- Click Configuration > Transports.
- The SMS-HTTP and SMS-WS transports should appear in the list and as active.
- If the transport we want to configure does not appear in the transport list:
- Click Add to open the Add Transport page.
- Select the check box next to the SMS transport we want to add to the site.
- Click Add to accept the changes. When you add a transport method to a site, it is automatically activated.
- If the transport we want to configure is inactive:
- Select the check box next to the inactive transport.
- Click Change Status.
- The transport status should change from Inactive to Active.
- Select the check box next to the SMS transport and click Configure.
- Complete the values for the parameters corresponding to the SMS transport you created. See Configuration of transport services used for a message for a description of these values. Click OK.
- Click Configuration > Message Types.
- Click New.
- From the Message Type list, select a message type. To send marketing text messages using a Dialog activity, select Marketing message.
- Specify a message severity range. In general, a message severity of 0,0 is recommended.
- From the Transport list, select SMS-HTTP or SMS-WS.
- From the Device format list, select SMS messages.
- Click Finish. The Message Type Configuration page displays. The Transport Status Column should be Active. If the transport status is not active, then the transport has been deactivated, or removed.
Note: You might encounter the following error if the Message Type is not completely configured:
CMN8413E: The messaging system cannot find an appropriate profile for MSGTYPE_ID "350"To avoid this issue, complete all the preceding Message Type configuration steps.
- Optional: Modify the Struts configuration file to customize the mapping of the message template to another JSP file. For marketing text messages, we can skip this step because these text messages are created in the Marketing tool as content.
- Open the struts-config.xml configuration file and add a new entry for the SMS message type you created. For example:
<forward className="com.ibm.commerce.struts.ECActionForward" name="yourView/0/-7" path="/yourJSPfile.jsp"> <set-property property="resourceClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/> <set-property property="properties" value="storeDir=no"/> <set-property property="interfaceName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommand"/> <set-property property="implClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/> <set-property property="direct" value="true"/> </forward>
The configuration file uses -7 as the SMS device format, as defined in the DEVICEFMT database table. The path parameter in your new entry is mapped to a JSP file.
- Save our changes and close the configuration file.
Results
After completing the preceding steps in order, you have:
- Added an SMS transport to the site using the Administration Console transports.
- Created and configured a message type using the Administration Console message types.
- Optional: Mapped the message type to a JSP file by editing the struts-config.xml configuration file.
Example
A sample mapping is created between the SMS transport and the sample OrderReceivedSMS.jsp file.
- Complete steps 1 through 14, based on the OrderReceived message type for the SMS transport.
- Create a new OrderReceivedSMS.jsp file with the following sample content:
<%@ page import="com.ibm.commerce.command.*" %><%@ page import="com.ibm.commerce.common.objects.*" %><%@ page import="com.ibm.commerce.server.*" %> <% try { JSPHelper jhelper = new JSPHelper(request); String orderId = jhelper.getParameter("orderId"); CommandContext commandContext = (CommandContext)request.getAttribute(ECConstants.EC_COMMANDCONTEXT); StoreAccessBean storeAB = commandContext.getStore(); StoreEntityDescriptionAccessBean storeEntDescAB = storeAB.getDescription(new Integer(storeAB.getLanguageId())); String storeName = storeEntDescAB.getDisplayName(); out.println("Thank you for shopping at "+ storeName + ". We received your order, number " + orderId + "."); } catch (Exception e) { out.println(e); } %>
- Open the struts-config.xml configuration file and insert the following code snippet:
<forward className="com.ibm.commerce.struts.ECActionForward" name="OrderReceivedView/0/-7" path="/OrderReceivedSMS.jsp"> <set-property property="resourceClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/> <set-property property="properties" value="storeDir=no"/> <set-property property="interfaceName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommand"/> <set-property property="implClassName" value="com.ibm.commerce.messaging.viewcommands.MessagingViewCommandImpl"/> <set-property property="direct" value="true"/> </forward>
In this example, the -7 value represents the SMS device format as defined in the DEVICEFMT database table, and maps the OrderReceived view to the OrderReceivedSMS.jsp file.
- Save the struts-config.xml configuration file. The sample OrderReceivedSMS.jsp file is now mapped to the OrderReceived view for the SMS transport.
Related concepts
SMS transport integration
Related reference
Configuration of transport services used for a message