Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The WSO2 Business Process Server can send email and SMS notifications to users when a human task notification occurs. This document provides instructions on enabling the email and SMS notification support for the human task notifications. 

...

Do the following steps to configure email notifications for human tasks.

  1. Open the <BPSOpen <EI_HOME>/wso2/repositorybusiness-process/conf/output-event-adapters.xml file.
  2. Edit the following configurations under email email  <adapterConfig type> element according to your required settings. 

    Code Block
    languagexml
     <adapterConfig type="email">
            <!-- Comment mail.smtp.user and mail.smtp.password properties to support connecting SMTP servers which use trust
            based authentication rather username/password authentication -->
            <property key="mail.smtp.from">bpsuser@gmail.com</property>
            <property key="mail.smtp.user">bpsuser</property>
            <property key="mail.smtp.password">bpsuserpassword</property>
            <property key="mail.smtp.host">smtp.gmail.com</property>
            <property key="mail.smtp.port">587</property>
            <property key="mail.smtp.starttls.enable">true</property>
            <property key="mail.smtp.auth">true</property>
    
            <!-- Thread Pool Related Properties -->
            <property key="minThread">8</property>
            <property key="maxThread">100</property>
            <property key="keepAliveTimeInMillis">20000</property>
            <property key="jobQueueSize">10000</property>
        </adapterConfig>  
    Note

    Note: The first three configuration parameters in the above XML code snippet must be modified to match your own parameter values.

  3. Open the <BPS<EI_HOME>/wso2/repositorybusiness-process/conf/humantask.xml file.
  4. Add the following configuration within the <HumanTaskServerConfig> tag.

    Code Block
    languagexml
    <EnableEMailNotification>true</EnableEMailNotification>
  5. To configure the email message, define the email message settings inside the .ht file. The .ht file can be accessed by unzipping the .zip file found in the <BPS_HOME>/repository/samples/humantask directory.

    Tip

    Tip: Use the rendering type “email”. This should be a child element of htd:notification.

    $firstname$ is a UI parameter that will be replaced with values.

    Add the following configurations.

    Code Block
    languagexml
    <htd:renderings>
    	<htd:rendering type="wso2:email">
    		<wso2:to name="to" type="xsd:string">bpsuser@gmail.com</wso2:to>
    		<wso2:subject name="subject" type="xsd:string">Email Subject</wso2:subject>
    		<wso2:body name="body" type="xsd:string">Hello $firstname$ $lastname$!</wso2:body>
              <!-- Supported Content Types text/plain, text/html -->
            <wso2:contentType name="contentType" type="xsd:string">text/html</wso2:contentType>
    	</htd:rendering>
    </htd:renderings>

    The following are the common tags used to define rendering.

    Tag nameDescription
    htd:renderings
    This is a main tag that includes different kinds of rendering sub tags that must be configured for notifications.
    htd:rendering

    This defines which kind of a rendering should be performed for the parameters inside this tag. You can use the type of attribute for defining the rendering type. In this case we use email.

    The following are tags specific to email rendering.

    Tag nameDescription
    htd:to
    This tag is where you define the destination email address of the notification.
    htd:subject

    This tag contains the subject line of the email that must be sent when the notification is created.

    htd:body

    This tag contains the body of the email that must be sent when the notification is created. The body can consist a user specified format, e.g., "Hello $lastname$, $firstname$".

  6. Make sure following namespace is included at the top of the .ht file.

    Code Block
    languagexml
    xmlns:wso2="http://wso2.org/ht/schema/renderings/"
  7. Save your changes.

...

Do the following steps to configure SMS notifications for human tasks.

  1. Open the <BPS<EI_HOME>/wso2/repositorybusiness-process/conf/axis2/axis2-client.xml file.
  2. Add the following configurations into the file.

    Code Block
    languagexml
    <transportSender class="org.apache.axis2.transport.sms.SMSSender" name="sms">
            <parameter name="systemType"></parameter>
            <parameter name="systemId">bps1</parameter>
            <parameter name="password">bps123</parameter>
            <parameter name="host">localhost</parameter>
            <parameter name="port">2775</parameter>
            <parameter name="phoneNumber">BPS1</parameter>
    </transportSender>
    Note

    Note: The first four configuration parameters in the above XML code snippet must be modified to match your own parameter values. The systemId and password parameters are provided by the SMS center or simulator that you use.

  3. Add the following .jar files to the <BPS<EI_HOME>/repository/components/lib directory.
  4. Open the <BPS<EI_HOME>/repositorywso2/business-process/conf/humantask.xml file.
  5. Add the following configuration within the <HumanTaskServerConfig> tag. Set this value to false if you want to turn these notifications off.

    Code Block
    languagexml
    <EnableSMSNotification>true</EnableSMSNotification>
  6. To configure the SMS message, define the SMS message settings inside the .ht file. The .ht file can be accessed by unzipping the .zip file found in the <BPS_HOME>/repository/samples/humantask directory.

    Tip

    Tip: Use the rendering type “SMS”. This should be a child element of htd:notification.

    $firstname$ is a UI parameter that will be replaced with values.

    Add the following configurations.

    Code Block
    languagexml
    <htd:renderings>
    	<htd:rendering type="wso2:sms">
    		<wso2:receiver name="receiver" type="xsd:string">94777123456</wso2:receiver>
    		<wso2:body name="body" type="xsd:string">Hi $firstname$</wso2:body>
    	</htd:rendering>
    </htd:renderings>

    The following are the common tags used to define rendering.

    Tag nameDescription
    htd:renderings
    This is a main tag that includes different kinds of rendering sub tags that must be configured for notifications.
    htd:rendering

    This defines which kind of a rendering should be performed for the parameters inside this tag. You can use the type of attribute for defining the rendering type. In this case we use sms.

    The following are tags specific to SMS rendering.

    Tag nameDescription
    htd:receiver
    This tag is where you define the number of the notification's receiver.
    htd:body

    This tag contains the content of the SMS that must be sent when the notification is created. The body can consist a user specified format, e.g., "Hello $lastname$, $firstname$".

  7. Make sure following namespace is included at the top of the .ht file.

    Code Block
    languagexml
    xmlns:wso2="http://wso2.org/ht/schema/renderings/"
  8. Save your changes.

...

  1. Download Logica SMS Simulator as a .zip file.
  2. Unzip the folder and open the user.txt file.
  3. Add following configurations to it. Here you must use the values you specified for systemId and password in step 2 of the Configuring SMS notifications section of this topic.
    • name=bps1
    • password=bps123
    • timeout=unlimited

      Tip

      Tip: Make sure there are no spaces between name value pairs, as spaces will not be removed. For instance, name= bps1 and name=bps1 will be considered as two users.


  4. Save the file and run the start.sh script from the terminal.
  5. Select option 1 to start the simulator. When the simulator requests the port number, provide the port value you configured in step 2 of the Configuring SMS notifications section of this topic.