Hi Manjula, On Thu, Jul 27, 2017 at 1:46 PM, Manjula Rathnayake <[email protected]> wrote:
> Hi Hariprasath, > > Looks good. I can see below improvements so that we can make this sample > personalized for anyone and get some customers around similar use cases. > 1. Steps taken to configure Gmail, Salesforce and Google Sheets. This > helps anyone to use their own account and configure. > 2. Externalize credentials, URLs into environment variables. Then it is a > matter of setting the correct values for those envs. > 3. Document the steps to invoke and verify the results. > 4. Steps to deploy this sample in Cloud and locally. > I have done this and you can find the documentation in[X] > 5. Steps to extend this sample such as commit this sample to a git repo, > steps to build it and deploy in Cloud back. > Why do we need to extend this? Because we can set the needed values in the environmetal variables and all the other parts are handled within the proxy. I will attached the proxy as well to explain this scenario. > 6. Support channel to ask questions on this sample and motivate to > contribute back to our sample repo. > +1 > 7. Health check for this sample to verify that individual connector APIs > are not updated(otherwise after some time, this sample will not work and we > will get to know only when customers report issues) > > If we can get above items done for this sample, then we can generalize it > as a template and enforce for all samples. > [X] - https://docs.google.com/a/wso2.com/document/d/1x9Jgcjt6cBG4_Vfd7110D1vNkaoXCpL_SlKBbwO8xIU/edit?usp=sharing > > > thank you. > > On Thu, Jul 27, 2017 at 1:20 PM, Malaka Silva <[email protected]> wrote: > >> Hi Hariprasath, >> >> Looks good. I guess we have to think in a way this can be reused on >> premise and in our integration cloud. >> >> On Thu, Jul 27, 2017 at 10:57 AM, Hariprasath Thanarajah < >> [email protected]> wrote: >> >>> Hi All, >>> >>> I am working on to create a sample scenario with ESB connectors >>> Salesforce SOAP, Google Spreadsheet and Gmail. For that, I used create >>> method of Sf SOAP connector to create the Lead and from the response of >>> that method we can able to get the Id of that record and using that Id we >>> can able to retrieve the information about that Lead creation using >>> retrieve method. After that, we need to insert the needed information of >>> that record to a spreadsheet using Google Spreadsheet connector using >>> addRowsData method and from getCellData method, we can able to retrieve the >>> information about the record. And finally, we can build the message >>> body with the above information and send an alert to the manager about the >>> Lead creation using Gmail Connector. >>> >>> Please find the above use case explanation in [1] and sample proxy can >>> be found in the attached file. >>> >>> [1] - >>> [image: Inline image 1] >>> >>> -- >>> >>> >>> *Thank you and Regards,**Hariprasath Thanarajah* >>> Software Engineer | WSO2 >>> E: [email protected] >>> M: +94 75 2806528 <075%20280%206528>, +94 77 7216903 <077%20721%206903> >>> Blog: hariwso2.blogspot.com >>> >>> Skype : hariss636 >>> LinkedIn : https://www.linkedin.com/in/hariprasath-thanarajah-5234b660 >>> >>> WSO2, Inc. >>> lean . enterprise . middleware >>> >>> https://wso2.com/signature >>> http://wso2.com/about/team/hariprashath-thanarajah/ >>> >> >> >> >> -- >> >> Best Regards, >> >> Malaka Silva >> Associate Director / Architect >> M: +94 777 219 791 <+94%2077%20721%209791> >> Tel : 94 11 214 5345 >> Fax :94 11 2145300 >> Skype : malaka.sampath.silva >> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77 >> Blog : http://mrmalakasilva.blogspot.com/ >> >> WSO2, Inc. >> lean . enterprise . middleware >> https://wso2.com/signature >> http://www.wso2.com/about/team/malaka-silva/ >> <http://wso2.com/about/team/malaka-silva/> >> https://store.wso2.com/store/ >> >> Don't make Trees rare, we should keep them with care >> > > > > -- > Manjula Rathnayaka > Technical Lead > WSO2, Inc. > Mobile:+94 77 743 1987 <+94%2077%20743%201987> > -- *Thank you and Regards,**Hariprasath Thanarajah* Software Engineer | WSO2 E: [email protected] M: +94 75 2806528, +94 77 7216903 Blog: hariwso2.blogspot.com Skype : hariss636 LinkedIn : https://www.linkedin.com/in/hariprasath-thanarajah-5234b660 WSO2, Inc. lean . enterprise . middleware https://wso2.com/signature http://wso2.com/about/team/hariprashath-thanarajah/
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="proxyWithGetEnv" startOnLoad="true" statistics="disable" trace="disable" transports="https,http"> <target> <inSequence> <script language="js">mc.setProperty("salesforcesoap.lead.firstname",java.lang.System.getenv("salesforcesoap_lead_firstname")); mc.setProperty("salesforcesoap.lead.lastname",java.lang.System.getenv("salesforcesoap_lead_lastname")); mc.setProperty("salesforcesoap.lead.email",java.lang.System.getenv("salesforcesoap_lead_email")); mc.setProperty("salesforcesoap.lead.company",java.lang.System.getenv("salesforcesoap_lead_company")); mc.setProperty("salesforcesoap.lead.username",java.lang.System.getenv("salesforcesoap_lead_username")); mc.setProperty("salesforcesoap.lead.password",java.lang.System.getenv("salesforcesoap_lead_password")); mc.setProperty("salesforcesoap.lead.loginurl",java.lang.System.getenv("salesforcesoap_lead_loginurl")); mc.setProperty("salesforcesoap.lead.blocking",java.lang.System.getenv("salesforcesoap_lead_blocking")); mc.setProperty("spreadsheet.lead.accessToken",java.lang.System.getenv("spreadsheet_lead_accessToken")); mc.setProperty("spreadsheet.lead.clientId",java.lang.System.getenv("spreadsheet_lead_clientId")); mc.setProperty("spreadsheet.lead.clientSecret",java.lang.System.getenv("spreadsheet_lead_clientSecret")); mc.setProperty("spreadsheet.lead.refreshToken",java.lang.System.getenv("spreadsheet_lead_refreshToken")); mc.setProperty("spreadsheet.lead.apiUrl",java.lang.System.getenv("spreadsheet_lead_apiUrl")); mc.setProperty("spreadsheet.lead.spreadsheetId",java.lang.System.getenv("spreadsheet_lead_spreadsheetId")); mc.setProperty("spreadsheet.lead.spreadsheetRange",java.lang.System.getenv("spreadsheet_lead_spreadsheetRange")); mc.setProperty("gmail.lead.userId",java.lang.System.getenv("gmail_lead_userId")); mc.setProperty("gmail.lead.refreshToken",java.lang.System.getenv("gmail_lead_refreshToken")); mc.setProperty("gmail.lead.clientSecret",java.lang.System.getenv("gmail_lead_clientSecret")); mc.setProperty("gmail.lead.clientId",java.lang.System.getenv("gmail_lead_clientId")); mc.setProperty("gmail.lead.accessToken",java.lang.System.getenv("gmail_lead_accessToken")); mc.setProperty("gmail.lead.apiUrl",java.lang.System.getenv("gmail_lead_apiUrl")); mc.setProperty("gmail.lead.managerEmailId",java.lang.System.getenv("gmail_lead_managerEmailId"));</script> <payloadFactory media-type="xml"> <format> <sfdc:sObjects xmlns:sfdc="sfdc" type="Lead"> <sfdc:sObject> <sfdc:FirstName>$1</sfdc:FirstName> <sfdc:LastName>$2</sfdc:LastName> <sfdc:Email>$3</sfdc:Email> <sfdc:Company>$4</sfdc:Company> </sfdc:sObject> </sfdc:sObjects> </format> <args> <arg evaluator="xml" expression="$ctx:salesforcesoap.lead.firstname"/> <arg evaluator="xml" expression="$ctx:salesforcesoap.lead.lastname"/> <arg evaluator="xml" expression="$ctx:salesforcesoap.lead.email"/> <arg evaluator="xml" expression="$ctx:salesforcesoap.lead.company"/> </args> </payloadFactory> <salesforce.init> <username>{$ctx:salesforcesoap.lead.username}</username> <password>{$ctx:salesforcesoap.lead.password}</password> <loginUrl>{$ctx:salesforcesoap.lead.loginurl}</loginUrl> <blocking>{$ctx:salesforcesoap.lead.blocking}</blocking> </salesforce.init> <salesforce.create> <allOrNone>0</allOrNone> <allowFieldTruncate>0</allowFieldTruncate> <sobjects xmlns:sfdc="sfdc">{//sfdc:sObjects}</sobjects> </salesforce.create> <payloadFactory media-type="xml"> <format> <sfdc:sObject xmlns:sfdc="sfdc"> <sfdc:Ids>$1</sfdc:Ids> </sfdc:sObject> </format> <args> <arg xmlns:ns="urn:partner.soap.sforce.com" evaluator="xml" expression="//ns:createResponse/ns:result/ns:id/text()"/> </args> </payloadFactory> <salesforce.init> <username>{$ctx:salesforcesoap.lead.username}</username> <password>{$ctx:salesforcesoap.lead.password}</password> <loginUrl>{$ctx:salesforcesoap.lead.loginurl}</loginUrl> <blocking>{$ctx:salesforcesoap.lead.blocking}</blocking> </salesforce.init> <salesforce.retrieve> <fieldList>FirstName,LastName,Email</fieldList> <objectType>Lead</objectType> <objectIDS xmlns:sfdc="sfdc">{//sfdc:sObject}</objectIDS> </salesforce.retrieve> <property xmlns:urn="urn:sobject.partner.soap.sforce.com" xmlns:ns="urn:partner.soap.sforce.com" expression="//ns:retrieveResponse/ns:result/urn:Email/text()" name="salesforce.lead.email" scope="default" type="STRING"/> <property xmlns:urn="urn:sobject.partner.soap.sforce.com" xmlns:ns="urn:partner.soap.sforce.com" expression="//ns:retrieveResponse/ns:result/urn:Id/text()" name="salesforce.lead.id" scope="default" type="STRING"/> <property xmlns:urn="urn:sobject.partner.soap.sforce.com" xmlns:ns="urn:partner.soap.sforce.com" expression="//ns:retrieveResponse/ns:result/urn:FirstName/text()" name="salesforce.lead.firstname" scope="default" type="STRING"/> <property xmlns:urn="urn:sobject.partner.soap.sforce.com" xmlns:ns="urn:partner.soap.sforce.com" expression="//ns:retrieveResponse/ns:result/urn:LastName/text()" name="salesforce.lead.lastname" scope="default" type="STRING"/> <script language="js">var mail = mc.getProperty("salesforce.lead.email"); var id = mc.getProperty("salesforce.lead.id"); var fname = mc.getProperty("salesforce.lead.firstname"); var lname = mc.getProperty("salesforce.lead.lastname"); var fields = "[["; if(mail !="" && mail !=null && id !="" && id !=null && fname !="" && fname !=null && lname !="" && lname !=null){ fields = fields.concat('"' + mail + '","' + id + '","' + fname + '","' + lname + '"'); } fields = fields.concat("]]"); mc.setProperty("spreadsheet.lead.raw",fields);</script> <googlespreadsheet.init> <accessToken>{$ctx:spreadsheet.lead.accessToken}</accessToken> <apiUrl>{$ctx:spreadsheet.lead.apiUrl}</apiUrl> <clientId>{$ctx:spreadsheet.lead.clientId}</clientId> <clientSecret>{$ctx:spreadsheet.lead.clientSecret}</clientSecret> <refreshToken>{$ctx:spreadsheet.lead.refreshToken}</refreshToken> </googlespreadsheet.init> <googlespreadsheet.addRowsColumnsData> <spreadsheetId>{$ctx:spreadsheet.lead.spreadsheetId}</spreadsheetId> <range>{$ctx:spreadsheet.lead.spreadsheetRange}</range> <valueInputOption>RAW</valueInputOption> <values>{$ctx:spreadsheet.lead.raw}</values> </googlespreadsheet.addRowsColumnsData> <property expression="json-eval($.updates.updatedRange)" name="spreadsheet.lead.updatedRange" scope="default" type="STRING"/> <googlespreadsheet.init> <accessToken>{$ctx:spreadsheet.lead.accessToken}</accessToken> <apiUrl>{$ctx:spreadsheet.lead.apiUrl}</apiUrl> <clientId>{$ctx:spreadsheet.lead.clientId}</clientId> <clientSecret>{$ctx:spreadsheet.lead.clientSecret}</clientSecret> <refreshToken>{$ctx:spreadsheet.lead.refreshToken}</refreshToken> </googlespreadsheet.init> <googlespreadsheet.getCellData> <spreadsheetId>{$ctx:spreadsheet.lead.spreadsheetId}</spreadsheetId> <range>{$ctx:spreadsheet.lead.updatedRange}</range> </googlespreadsheet.getCellData> <property expression="json-eval($.values[0][0])" name="spreadsheet.lead.mailId" scope="default" type="STRING"/> <property expression="json-eval($.values[0][1])" name="spreadsheet.lead.sfId" scope="default" type="STRING"/> <property expression="json-eval($.values[0][2])" name="spreadsheet.lead.firstName" scope="default" type="STRING"/> <property expression="json-eval($.values[0][3])" name="spreadsheet.lead.lastName" scope="default" type="STRING"/> <script language="js">var mail = mc.getProperty("spreadsheet.lead.mailId"); var id = mc.getProperty("spreadsheet.lead.sfId"); var fname = mc.getProperty("spreadsheet.lead.firstName"); var lname = mc.getProperty("spreadsheet.lead.lastName"); var contentType = "The New Lead Registration detail is: " if(mail !="" && mail !=null && id !="" && id !=null && fname !="" && fname !=null && lname !="" && lname !=null){ contentType = contentType.concat('"The Email Id is: ' + mail + '","The Salesforce Id is: ' + id + '","The Firstname is: ' + fname + '","The Lastname is: ' + lname + '"'); } mc.setProperty("gmail.lead.contentBody",contentType);</script> <gmail.init> <userId>{$ctx:gmail.lead.userId}</userId> <accessToken>{$ctx:gmail.lead.accessToken}</accessToken> <apiUrl>{$ctx:gmail.lead.apiUrl}</apiUrl> <clientId>{$ctx:gmail.lead.clientId}</clientId> <clientSecret>{$ctx:gmail.lead.clientSecret}</clientSecret> <refreshToken>{$ctx:gmail.lead.refreshToken}</refreshToken> </gmail.init> <gmail.sendMail> <to>{$ctx:gmail.lead.managerEmailId}</to> <subject>New Lead Registration</subject> <from>{$ctx:gmail.lead.userId}</from> <messageBody>{$ctx:gmail.lead.contentBody}</messageBody> <contentType>text/html; charset=UTF-8</contentType> </gmail.sendMail> <property expression="$axis2:HTTP_SC" name="sendMailToManager"/> <filter regex="true" source="get-property('sendMailToManager') != 200"> <then> <log level="full"/> <property name="responseMessage" value="Unable to Send the Message to Manager "/> <loopback/> </then> <else> <log level="full"/> <property name="responseMessage" value="Send an alert successfully"/> <loopback/> </else> </filter> <respond/> <send/> </inSequence> <outSequence> <property name="messageType" scope="axis2" value="application/json"/> <payloadFactory media-type="json"> <format> { "Response":{ "process":"Send the mail alert", "activityResponse":"$1" } } </format> <args> <arg evaluator="xml" expression="get-property('responseMessage')"/> </args> </payloadFactory> <log/> <send/> </outSequence> <faultSequence/> </target> <description/> </proxy>
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
