Enabling and configuring the SMS transport

Enabling the Short Message Service (SMS) transport extends cross-channel access by offering mobile device capabilities in HCL Commerce. Mobile messaging enhances the shopper's access to information by providing access through their mobile device.

About this task

This task enables and configures the SMS transport in HCL 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

  1. Open the Administration Console and select Site or Store, on the Administration Console Site/Store Selection page.
  2. Click Configuration > Transports.
  3. The SMS-HTTP and SMS-WS transports should appear in the list and as active.
    1. If the transport you want to configure does not appear in the transport list:
      1. Click Add to open the Add Transport page.
      2. Select the check box next to the SMS transport you want to add to the site.
      3. Click Add to accept the changes. When you add a transport method to a site, it is automatically activated.
    2. If the transport you want to configure is inactive:
      1. Select the check box next to the inactive transport.
      2. Click Change Status.
      3. The transport status should change from Inactive to Active.
  4. Select the check box next to the SMS transport and click Configure.
  5. 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.
  6. Click Configuration > Message Types.
  7. Click New.
  8. From the Message Type list, select a message type.
    To send marketing text messages using a Dialog activity, select Marketing message.
  9. Specify a message severity range. In general, a message severity of 0,0 is recommended.
  10. From the Transport list, select SMS-HTTP or SMS-WS.
  11. From the Device format list, select SMS messages.
  12. 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, ensure that you complete all the preceding Message Type configuration steps.
  13. Optional: Modify the Struts configuration file if you want to customize the mapping of the message template to another JSP file. For marketing text messages, you can skip this step because these text messages are created in the Marketing tool as content.
    1. 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.

    2. Save your changes and close the configuration file.

Results

After completing the preceding steps in order, you have:
  1. Added an SMS transport to the site using the Administration Console transports.
  2. Created and configured a message type using the Administration Console message types.
  3. 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.

  1. Complete steps 1 through 14, based on the OrderReceived message type for the SMS transport.
  2. 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);
    }
    %>
    
  3. 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.

  4. Save the struts-config.xml configuration file. The sample OrderReceivedSMS.jsp file is now mapped to the OrderReceived view for the SMS transport.