Fluent Commerce Logo
Docs
Sign In

Installing rubix-plugin-email

How-to Guide

Author:

Fluent Commerce staff

Changed on:

12 Feb 2024

Key Points

  •   Upon following the guide, you would be able to set up a "send email” button for specific order statuses, which will be plugged to the email service 

Steps

Step arrow right iconSet up a mailing template on Mandrill

Go to mandrill and setup a mailing template. Ensure the template name is unique. For Example: RANDY_HD_FLUENT_NOTIFICATION:

No alt provided


Step arrow right iconUnzip the file

Get the rubix-plugin-email zip file from our ES team. unzip the file in your local computer.  The unzipped folder should contains pom.xml file and src folder.

No alt provided

Step arrow right iconView the content on IntelliJ

Open IntelliJ (ensure the right Java and Maven versions have been setup), in the IntelliJ, open the unzipped folder (in my example, my folder name is “rubix-plpugin-email 2”). Then double click on pom.xml file to view the content:

No alt provided

Step arrow right iconModify pom.xl

Change the following in the pom.xml:

  • Set the version number (number that you would like to prefer) in line8 to:
    `<version>1.0.10</version>`
  • Set the symbolic name: in line 40 with your sandbox Account ID and package name you want to call.  (in my example, the name is EMAIL):
    `<rubix.osgi.symbolic.name>RANDY.EMAIL</rubix.osgi.symbolic.name>`

Note: Both Account ID and name are case sensitive. ensure you have provided correct case.


Step arrow right iconBuild the package

Open Maven within the IntelliJ, go to rubix-plugin-email->Lifecycle and select “clean” and “package” (Cmd+Click). then click on the run (green arrow) button to build the package:

No alt provided

The result window should display “BUILD SUCCESS” message:

1[INFO] --- maven-bundle-plugin:3.0.1:bundle (package-bundle) @ rubix-plugin-email ---
2[WARNING] Bundle com.fluentcommerce:rubix-plugin-email:jar:1.0.11 : Unused Import-Package instructions: [com.google.code.*, feign.*] 
3[INFO] ------------------------------------------------------------------------
4[INFO] BUILD SUCCESS
5[INFO] ------------------------------------------------------------------------
6[INFO] Total time:  29.264 s
7[INFO] Finished at: 2021-09-09T16:35:26+10:00
8[INFO] ------------------------------------------------------------------------
9
10Process finished with exit code 0 

Language: json

Name: Result

Description:

[Warning: empty required content area]

Step arrow right iconVerify that “target” folder is created

Go to the unzipped folder,  a new folder “target” is created from the previous step.  The target folder contains the jar file that we can upload into rubix in next step.

No alt provided

Step arrow right iconRun OAuth

Now go to Postman, run Account OAUTH and go to “plugin - Upload” request.  In the Body tab,  A “Select Files” button is located under value section. 

No alt provided

Step arrow right iconOpen the jar file

Click on the button, go to target folder path and select the jar file, then click on Open button.

No alt provided

Step arrow right iconClick send

Back in the Request page, click on “Send” button on the right and you should get the status 200 OK

No alt provided

Step arrow right iconModify the request

Then open “Plugin - Install (or activate)” request: {{fluentApiHost}}/orchestration/rest/v1/plugin/install

Change the body to the following:

1{
2  "accountId": "RANDY",
3  "bundleName": "RANDY.EMAIL::1.0.11"
4}

Language: json

Name: Body

Description:

[Warning: empty required content area]

Where accountId = your sandbox account ID

BundleName:  <the symbolic name>::<version number>

Symbolic name and version number can be found in your pom.xml file. (From Step4).  

Click on “Send” button and should get status 200 OK with blank response:

No alt provided

Step arrow right iconCheck that the new rule is installed

 go to “Plugin - Rule”  GET: {{fluentApiHost}}/orchestration/rest/v1/plugin to check if the new rule is installed into your sandbox:

No alt provided

Step arrow right iconConfigure EMAIL.SERVICE.CONFIG

Go to the Admin Console -> Settings and configure EMAIL.SERVICE.CONFIG (refer to: 

Sending Emails )

1{
2    "MANDRILL_PROD_KEY": "KEYKEYKLEYKEYKEYKEY",
3    "RANDY_CUSTOMER_NOTIFY": {
4        "fromName": "Randy",
5        "fromEmail": "randy.chan@fluentcommerce.com",
6        "toEmail": "randy.chan@fluentcommerce.com",
7        "toName": "R CHAN",
8        "ccEmail": "",
9        "ccName": "",
10        "bccEmail": "",
11        "bccName": "",
12        "replyTo": "",
13        "subject": "Items in your Order can be picked",
14        "mandrillTemplate": "RANDY_HD_FLUENT_NOTIFICATION"
15    }
16}

Language: json

Name: EMAIL.SERVICE.CONFIG

Description:

[Warning: empty required content area]

Step arrow right iconAdd the code to the Workflow

Go to the HD order workflow, add the following code into your workflow.  the code will add a user action button for “BOOKED” order. when the button is clicked, it will be calling RANDY.EMAIL.SendEmail* rules that installed from the above.  Ensure that the value in line 13 is aligned with line 3 in Settings.

1{
2            "name": "SendEmailButton",
3            "type": "ORDER",
4            "subtype": "HD",
5            "eventType": "NORMAL",
6            "rules": [
7                {
8                    "name": "RANDY.EMAIL.SendEmailEventWithAttributes",
9                    "props": {
10                        "receiver": "randy.chan@fluentcommerce.com",
11                        "eventName": "SendEmailForOrder",
12                        "emailConfigSetting": "RANDY_CUSTOMER_NOTIFY"
13                    }                    
14                }
15            ],
16            "triggers": [
17                {
18                    "status": "BOOKED"
19                }
20            ],
21            "userActions": [
22                {
23                    "context": [
24                        {
25                            "label": "send email",
26                            "type": "SECONDARY",
27                            "modules": [
28                                "adminconsole",
29                                "servicepoint"
30                            ],
31                            "confirm": false
32                        }
33                    ],
34                    "attributes": []
35                }
36            ]
37        },
38     {
39      "name": "SendEmailForOrder",
40      "description": "Sends email for order entity",
41      "type": "ORDER",
42      "subtype": "HD",
43      "eventType": "NORMAL",
44      "rules": [
45        {
46          "name": "RANDY.EMAIL.SendEmailFromEvent",
47          "props": null
48        }
49      ],
50      "triggers": [
51        {
52          "status": "BOOKED"
53        }
54      ],
55      "userActions": []
56    }

Language: json

Name: Code-WF

Description:

[Warning: empty required content area]
No alt provided

Step arrow right iconCheck your inbox:

check your inbox:

No alt provided

Step arrow right iconLoad an order in Booked status

Load in a HD order into BOOKED status, go to the Order detail page and click on “SEND EMAILS” button. A Successfully message should be displayed.

No alt providedNo alt provided

Step arrow right iconSample of the Mandrill template

Sample Mandrill template

1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2<html>
3<head>
4    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5    <meta name="viewport" content="width=device-width, initial-scale=1">
6    <style type="text/css">
7        @media screen and (max-width: 680px) {
8            #wrapper_td {
9                padding: 15px !important;
10            }
11            #container {
12                width: 100% !important;
13            }
14            #body {
15                width: 100% !important;
16            }
17            #body_logo {
18                width: auto !important;
19            }
20            #body_logo img {
21                width: 75% !important;
22            }
23            #store_details-address td,
24            #store-details_hours td {
25                width: 100% !important;
26            }
27            #body_store-details table {
28                width: 100% !important;
29            }
30            #footer {
31                width: 100% !important;
32            }
33        }
34    </style>
35</head>
36<body style="margin: 0; padding: 0;">
37    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" id="wrapper"
38        style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; table-layout: fixed;">
39        <tr>
40            <td align="center" bgcolor="" id="wrapper_td" style="padding: 0;">
41                <table border="0" cellspacing="0" align="center" id="container"
42                    style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 600px; margin: 0; padding: 0;">
43                    <tr>
44                        <td style="padding: 0;">
45                            <table border="0" cellpadding="0" bgcolor="#ffffff" id="body"
46                                style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 600px;">
47                                <tr>
48                                    <td align="left" style="padding: 0;">
49                                        <table align="center" border="0" cellpadding="0" bgcolor="#ffffff"
50                                            id="body_logo"
51                                            style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; text-align: center; width: 100%;">
52                                            <tr>
53                                                <td align="center" border="0" id="body_logo_td"
54                                                    style="text-align: center; padding: 20px 0;">
55                                                    <table align="center"
56                                                        style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: auto; margin: 0 auto;">
57                                                        <tr>
58                                                            <td border="0" align="center" valign="top"
59                                                                style="width:200px;"> <img
60                                                                    src="https://fluentcommerce.com/wp-content/uploads/2019/07/fluent-commerce-logo.svg"
61                                                                    style="background-color: #ffffff" width="200px">
62                                                            </td>
63                                                        </tr>
64                                                    </table>
65                                                </td>
66                                            </tr>
67                                        </table>
68                                        <table border="0" cellpadding="0" bgcolor="#ffffff" id="body_intro"
69                                            style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 100%;">
70                                            <tr>
71                                                <td height="30" style="text-align: left; padding: 0;" align="left">
72                                                </td>
73                                            </tr>
74                                            <tr>
75                                                <td style="text-align: left; padding: 0;" align="left">
76                                                    <h1
77                                                        style="font-family: Arial; font-size: 27px; line-height: 32px; margin: 0;">
78                                                        Fluent Notification Email (Randy Test)</h1>
79                                                </td>
80                                            </tr>
81                                            <tr>
82                                                <td height="30" style="text-align: left; padding: 0;" align="left">
83                                                </td>
84                                            </tr>
85                                            <tr>
86                                                <td style="text-align: left; padding: 0;" align="left">
87                                                    <h3
88                                                        style="font-family: Arial; font-size: 16px; font-weight: normal; line-height: 16px; margin: 0;">
89                                                        <strong>Order number: {{orderNumber}}</strong>
90                                                    </h3>
91                                                </td>
92                                            </tr>
93                                            <tr>
94                                                <td height="15" style="text-align: left; padding: 0;" align="left">
95                                                </td>
96                                            </tr>
97                                            <tr>
98                                                <td class="spacing_after" style="text-align: left; padding: 0 0 45px;"
99                                                    align="left"> This is randy testing. Hello World. </td>
100                                            </tr>
101                                        </table>
102                                        <table cellpadding="0" cellspacing="0" id="body_store-details"
103                                            style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 100%;">
104                                            <tr>
105                                                <td style="padding: 0;"> </td>
106                                            </tr>
107                                            <tr>
108                                                <td class="section-border"
109                                                    style="border-top-style: solid; border-top-width: 1px; border-top-color: #000000; padding: 16px 0 0;">
110                                                    <table align="left" cellpadding="0" cellspacing="0"
111                                                        id="customer-details_address"
112                                                        style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 260px;">
113                                                        <tr>
114                                                            <td
115                                                                style="width: 260px; font-family: Arial; font-size: 12px; padding: 0 0 16px;">
116                                                                <strong>Customer Details:</strong>
117                                                                <br>{{firstName}} {{lastName}}
118                                                                <br>{{companyName}}
119                                                                <br>{{address1}}
120                                                                <br>{{address2}}
121                                                                <br>{{city}}
122                                                                <br>{{state}}
123                                                                <br>{{postcode}}
124                                                                <br>{{country}}
125                                                                <br>{{contactNumber}}
126                                                                <br>{{email}}
127                                                            </td>
128                                                        </tr>
129                                                    </table>
130                                                    <table align="right" cellpadding="0" cellspacing="0"
131                                                        id="shipment-details"
132                                                        style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 260px;">
133                                                        <tr>
134                                                            <td
135                                                                style="width: 260px; font-family: Arial; font-size: 12px; padding: 0 0 16px;">
136                                                                <strong>Order Details:</strong>
137                                                                <br>Order Creation Date: {{orderCreationDateInFluent}}
138                                                                <br>Requested Ship Date: {{requestedShipDate}}
139                                                                <br>Store Front ID: {{StoreFrontId}}
140                                                                <br>Shipping Method: {{shippingMethodRef}}
141                                                            </td>
142                                                        </tr>
143                                                    </table>
144                                                </td>
145                                            </tr>
146                                        </table>
147                                        <table cellpadding="0" cellspacing="0" id="body_store-details"
148                                            style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 100%;">
149                                            <tr>
150                                                <td style="padding: 0;"> </td>
151                                            </tr>
152                                            <tr>
153                                                <td class="section-border"
154                                                    style="border-top-style: solid; border-top-width: 1px; border-top-color: #000000; padding: 16px 0 0;">
155                                                    <table border="0" cellpadding="0" bgcolor="#ffffff" id="body_intro"
156                                                        style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 100%;">
157                                                        <tr>
158                                                            <td style="text-align: left; padding: 0;" align="left">
159                                                                <h2
160                                                                    style="font-family: Arial; font-size: 16px; line-height: 16px; margin: 0;">
161                                                                    Order Line Details:</h2>
162                                                            </td>
163                                                        </tr>
164                                                        <tr>
165                                                            <td height="15" style="text-align: left; padding: 0;"
166                                                                align="left"> </td>
167                                                        </tr>
168                                                    </table>
169                                                    <table border="0" cellpadding="0" width="" bgcolor="#ffffff"
170                                                        id="body_items"
171                                                        style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 100%;">
172                                                        <tr>
173                                                            <td width="100%" class="spacing_after"
174                                                                style="padding: 0 0 45px;">
175                                                                <table cellpadding="0" id="items_ready"
176                                                                    style="table-layout: fixed; border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 20px; width: 100%;">
177                                                                    <tr class="subtitle section-border"
178                                                                        style="border-top-style: solid; border-top-width: 1px; border-top-color: #000000; padding: 30px 0 0;">
179                                                                        <td><strong>Product Ref</strong></td>
180                                                                        <td><strong>Product Name</strong></td>
181                                                                        <td><strong>Brand</strong></td>
182                                                                        <td><strong>UOM</strong></td>
183                                                                        <td><strong>Ordered Qty</strong></td>
184                                                                    </tr> {{#each fulfilmentItemList}}
185                                                                    <tr>
186                                                                        <td style="word-wrap: break-word">{{skuRef}}
187                                                                        </td>
188                                                                        <td style="word-wrap: break-word">
189                                                                            {{productName}}</td>
190                                                                        <td style="word-wrap: break-word">{{brand}}</td>
191                                                                        <td style="word-wrap: break-word">
192                                                                            {{unitOfMeasure}}</td>
193                                                                        <td style="word-wrap: break-word">
194                                                                            {{requestedQuantity}}</td>
195                                                                    </tr> {{/each}}
196                                                                </table>
197                                                            </td>
198                                                        </tr>
199                                                    </table>
200                                                </td>
201                                            </tr>
202                                        </table>
203                                        <table border="0" width="600" cellpadding="" id="footer"
204                                            style="border-spacing: 0; font-family: Arial; font-size: 12px; line-height: 16px; width: 600px; margin: 0;">
205                                            <tr>
206                                                <td align="left" border="0" class="spacing_after"
207                                                    style="width: 100%; padding: 15px 0 45px;"> <img
208                                                        src="https://fluentcommerce.com/wp-content/uploads/2019/07/fluent-commerce-logo.svg"
209                                                        style="background-color: #ffffff" width="180"> </td>
210                                            </tr>
211                                        </table>
212                                    </td>
213                                </tr>
214                            </table>
215                        </td>
216                    </tr>
217                </table>
218</body>
219</html>

Language: html

Name: Sample of mandrill template

Description:

[Warning: empty required content area]
Fluent Commerce staff

Fluent Commerce staff

Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo