July 23, 2019

Testing of dynamic email notification integration


STEP 1 : Activate the dynamic email Integration which was created in 
              the previous blog.



             Click Activate.



 STEP 2 :  Once the integration get activated click to open the endpoint
                URL as shown in below image.



              Copy the Endpoint URL 




STEP 3 :  Open the SOAP UI Tool & click on REST 


             Paste the Endpoint URL which you have copied in STEP 2 & click OK
             

STEP 4 :  Configure the below details as it is :
  1. Method :   select POST 
  2. Media Type :    select application/xml      
  3. Enter the below details in box   
        <EmployeeDetails>
               <Employee>
                    <Name>Chetan</Name>
                    <City>Bangalore</City>
               </Employee>
               <Employee>
                   <Name>Shreya</Name>
                   <City>Pune</City>
             </Employee>
        </EmployeeDetails>            


        **Now add the Authentication as suggested in sequence in below Image
         Here you have to enter your OIC Instance UserId & Password








        Click the RUN button as shown in below image


           In response payload you will get 202 Accepted message. It means your 
        Dynamic Email Integration get hitted successfully.
        



    

        You can track your Integration flow by opening the OIC Instance and then 

        open the Monitoring Window and then click at Tracking.

     
STEP 5 :  Testing completed, You will get one email notification as shown below 
                With the Inputs in Tabular form which you have passed in SOAP UI 
                as Inputs.


How to develop an integration to get dynamic email notification

Knowledge :  👀 
Notification? : Enables you to send notification email to relevant users at specific points in the execution of an integration.

Use Case : 
In this blog we will see how to develop an Integration to get dynamic email notification.
                
suppose we pass one sets of record, we will get email notification having one sets of record (as shown in below image)



Similarly if we pass two sets of record, we will get email notification having two sets of record.        

Lets see the development steps in detail :

STEP 1:  
Create a new App Driven Orchestration :



Enter the below details and click Create:

*What do you want to call your Integration? : Write a meaningful name
  What does this Integration do? : write meaningful description
            

STEP 2:  
Search for the REST Connection which we have created earlier and configure it as shown in below image
[ You can access this blog to know - how to Create REST Connection ]


Enter below details and click next - as shown in below image:

*What do you want to call your endpoint ? : write meaningful name
*What is the endpoint's relative resource URI ? : 
 You can give any meaningful word with "/" 
 Example : /dynamicEmail

* What action do you want to perform on the endpoint ? : select POST 
            
   &
   select Configure a request payload for this endpoint


   ***Save this below Schema as Email.xsd

  download Email.xsd file from here - click to download

Choose the above saved schema " Email.xsd " in next window & click Next 
and then click done
[as shown in below image]


  

STEP 3: Now add one Assign action


Knowledge :  👀 
Assign ? Enables you to assign variables to integrations.

         
Enter below details & click Create:
*Name : write a meaningful name
Description : write small description
         
click on " + " icon to add variable 

      
Write variable name as vEmail (you can give any meaningful name)and  
click Edit button 
  

Write the below code in Expression box and click Validate & then click     
Close 

      "<table>
         <tr>
         <th>Name</th>
         <th>City</th>
         </tr>"


STEP 4 : 
Now add one For Each action 



Knowledge :  👀 
ForEach ?  Enables you to loop over a repeating element and execute one more actions within the scope of the for-each action.


Enter the below details and click Create :
*Name : write one meaningful name
*Repeating Element : drag and drop the Employee tag from Source side as shown in below image 
*Current Element Name : Current  (you can give any meaningful name but make a note of it because you need it later in this integration)
             

STEP 5: 
Now add one Assign inside Foreach 


Enter below details & click Create :
*Name : write one meaningful name 
 Description : write some meaningful description


 Click " + " Select the Existing Variable " vEmail " and then click Edit :


         
***configure the Expression using Concat function and by dragging and   
      dropping the required fields form Source
      as shown in below image and then click Validate 
             
 use this HTML Code in Expression
 style='background-color:#C9CBCA;font-weight: lighter'
         
     
STEP 6:  
Now add one assign outside of foreach to close the table


Write one meaningful name and click Create

Click the " + " icon and select the existing variable " vEmail " and click Edit
   


 Enter the below details inside Expression box to close the table and click 
 Validate and then Click Close.

      concat($vEmail, "</table>")


STEP 7: 
Now the last part, add one Notification as shown in below image


                    
Enter the below details and then click Create :
*Name :write one meaningful name
 Description : write some description


Knowledge :  👀 
Notification? : You Enables you to send notification email to relevant users at specific points in the execution of an integration.

     
         Now configure the Notification Payload by entering below details :      

           1. Click on " + " icon and give 

                       ParameterName = body  (will use this in below HTML Body )
                      & then click edit and provide 
                      the Parameter Value by dragging and dropping the   
                       vEmail variable form Source as shown in below images  



            2. Now enter the below details and click Validate and then click Close:
                       *From : Write from email address
                       *To : write the email address in which you want the Notifiaction

                       *Body : Enter the below HTML code as it is inside Body. This is 
                        a simple HTML code to define Email payload , you can use your  
                        own. 
                        **The important point is that inside the <div> tag ,the 
                        above defined parameter value {body} is added which contains 
                        our dynamic email values.


<html>

<head>
<style>
table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
}
th, td {
  padding: 5px;
  text-align: left;
}

table th {
  background-color:#154668;
  color: white;
}
  p{
  margin : 0;
  padding : 0;
  }
</style>
</head>
<body>
<br>
<br>
<p>Hi There,</p>
<p> Below is the list of Employee details :</p>
<br>
<div>
{body}
</div>
<br>
<p>Thanks,</p>
<p>XYZ</p>
</body>
</html>

 

STEP 8:  
Last but not the least , enable the tracking as shown in below image

drag and drop the Name column and then click save.


Knowledge :  👀 
Assigning Business Identifiers for Tracking Fields ? : Business identifiers enable you to track payload fields in messages during runtime.You must assign business identifiers before you can activate an integration.

               
Done, you have successfully created the dynamic email notification service. Click SAVE and CLOSE the Integration. Please see NEXT blog to TEST this service. Thank You !