Picture of Upload customer budgets | GT_GEN_007

Upload customer budgets | GT_GEN_007

Here, we will learn how to set up and utilise functionality allowing the automatic updating of customer budgets. Once configured, this functionality allows CSV files uploaded to a Hotfolder to be read and then automatically update customer budgets via a MegaScript.

Tutorial Video Transcript

00:00:08:02 - 00:00:08:10
Here.

00:00:08:10 - 00:00:10:26
We'll learn how to set up and utilize
functionality

00:00:10:26 - 00:00:14:10
allowing the automatic
updating of customer budgets.

00:00:15:00 - 00:00:17:22
Once configured, this functionality
allows CSV

00:00:17:26 - 00:00:22:01
files
uploaded to a specified folder to be read

00:00:22:01 - 00:00:26:01
and then automatically update
customer budgets via a Megascript.

00:00:27:27 - 00:00:31:00
So to begin, we'll just take a quick
look at our customers.

00:00:31:01 - 00:00:35:07
So I'm just going to navigate
to customer management.

00:00:38:07 - 00:00:40:07
Now, the Megascripts
that we're going to create,

00:00:40:07 - 00:00:41:07
which we'll see later,

00:00:41:07 - 00:00:45:07
can be configured to check for various
different customer identifiers.

00:00:45:18 - 00:00:48:09
This could be the ID
number of the customer.

00:00:48:21 - 00:00:51:09
It could be the email address,

00:00:51:09 - 00:00:53:23
or it could be a user name
if you have one specified.

00:00:54:07 - 00:00:58:15
You've got to ensure that your customer
accounts have the required data included.

00:00:58:29 - 00:01:01:12
So if you want to use username
as your identifier,

00:01:01:13 - 00:01:04:25
make sure that all of your customer
accounts have username.

00:01:05:29 - 00:01:07:06
In our example, we're going to keep it

00:01:07:06 - 00:01:12:04
simple
and just utilize the email identifier.

00:01:13:24 - 00:01:17:26
So next will ensure
that the required folders are configured.

00:01:18:11 - 00:01:22:15
I'm just going to go to the folders
section in our Infigo admin area.

00:01:23:26 - 00:01:27:13
So in our case I have not specified
anything up until this point.

00:01:27:13 - 00:01:29:20
So I'm just going to set that up
very quickly.

00:01:29:20 - 00:01:33:10
I'm not going to spend much time going
through folders and print locations here.

00:01:33:20 - 00:01:37:10
You'll find information on those
in other tutorial resources.

00:01:38:13 - 00:01:41:02
I'm just going to very quickly
create a new print location

00:01:42:28 - 00:01:46:17
just to keep these separate
from the folders.

00:01:46:18 - 00:01:49:05
This isn't a necessary step.

00:01:49:05 - 00:01:53:03
And then within the hop,
the print location I've just created.

00:01:53:14 - 00:01:57:26
I'm going to create
a couple of new folders.

00:01:59:00 - 00:02:01:11
Two folders are required
for this functionality.

00:02:01:19 - 00:02:04:11
One will be the upload location
for our budget.

00:02:04:12 - 00:02:05:26
CSV Files

00:02:05:26 - 00:02:09:25
and the other will store processed files
once the Megascript has been run.

00:02:10:03 - 00:02:12:17
And this is more for reference purposes.

00:02:12:17 - 00:02:15:10
So I'm going to create two here,
which are called budgets,

00:02:15:10 - 00:02:20:16
which is going to be where I actually
initially input my CSV files

00:02:25:12 - 00:02:27:18
and I'm going to create a second one

00:02:27:18 - 00:02:29:23
which I call in my case,

00:02:30:09 - 00:02:46:14
processed budgets.

00:02:50:15 - 00:02:52:00
Now these are appropriate names,

00:02:52:00 - 00:02:55:12
but really you can name these folders
as you see fit.

00:02:55:26 - 00:03:00:13
The only thing you really need to do
is note down the ID numbers of those two

00:03:00:13 - 00:03:01:19
hot folders as

00:03:01:19 - 00:03:05:06
these are going to be needed to be input
into the actual Megascript itself.

00:03:05:23 - 00:03:09:26
So in my case, these are nine and ten.

00:03:11:21 - 00:03:12:15
Next, we're going to start

00:03:12:15 - 00:03:14:26
configuring the actual Megascript itself.

00:03:15:15 - 00:03:17:28
So I'm going to navigate to the mega

00:03:17:28 - 00:03:25:10
script management section,
make sure that budget is selected,

00:03:25:29 - 00:03:29:02
and then click on Save.

00:03:35:00 - 00:03:35:26
Next, we'll navigate

00:03:35:26 - 00:03:45:05
to Megascript instances,

00:03:45:05 - 00:03:48:28
and this is where we actually configure
that Megascript that we've just enabled.

00:03:49:10 - 00:03:52:20
So what I want to do
is from this dropdown list on the top

00:03:52:20 - 00:03:56:18
right, select the Megascript
that I want to create an instance for.

00:03:56:28 - 00:04:02:02
So in this case, it's budget
and then click on Create.

00:04:05:04 - 00:04:05:22
Now from here,

00:04:05:22 - 00:04:08:22
we just need to complete the Megascript selection options.

00:04:09:04 - 00:04:13:06
So first of all,
we'll give the Megascript a name.

00:04:13:07 - 00:04:16:21
So I just call it budget two
as I think I have budget elsewhere

00:04:16:22 - 00:04:19:23
on this particular storefront.

00:04:20:11 - 00:04:22:13
I'll make sure
that the Megascript is enabled

00:04:23:01 - 00:04:26:29
and then I've got a
few additional options here.

00:04:28:12 - 00:04:31:04
Now, please
do note that if your Megascript fails

00:04:31:04 - 00:04:34:07
for whatever reason, so let's say
it's not being configured quite correctly,

00:04:34:19 - 00:04:37:06
then it will automatically disable
the Megascript

00:04:37:06 - 00:04:40:17
so it doesn't start automatically running
when it knows it's going to fail.

00:04:41:00 - 00:04:44:03
You'll need to navigate
back to this screen and re-enable it again

00:04:44:14 - 00:04:48:01
in order to retry the process.

00:04:48:01 - 00:04:51:28
If you wish to be able to trigger
the script manually, then select purge

00:04:51:29 - 00:04:54:19
manually.

00:04:54:19 - 00:04:57:28
And if you wish for the script
to run automatically in the background

00:04:57:28 - 00:05:01:17
at a specified interval,
then click on run background

00:05:01:28 - 00:05:06:00
that will give you a new pop up box
which you can utilize, which allows you

00:05:06:00 - 00:05:11:02
to specify the interval in which
that script is run in the background.

00:05:11:17 - 00:05:14:06
So in my case, just because
we want to actually demonstrate this,

00:05:14:15 - 00:05:17:20
I'll just say every 2 minutes.

00:05:20:05 - 00:05:23:07
Now, if we scroll down
a little bit further, we need to input

00:05:23:07 - 00:05:27:11
the Megascript configuration options
into the configuration

00:05:27:11 - 00:05:29:29
input here.

00:05:32:04 - 00:05:35:05
Now you'll find information
on the relevant code

00:05:35:12 - 00:05:40:19
on the associated step by step guide
for this particular tutorial.

00:05:41:06 - 00:05:45:17
If I just show you on screen here
what it is we're trying to create.

00:05:47:00 - 00:05:49:15
So we need to copy this code
into the configuration

00:05:49:15 - 00:05:52:05
input box.

00:05:55:20 - 00:05:59:02
Now, this code should be amended to suit

00:05:59:02 - 00:06:02:14
your specific set up and requirements,
and the values

00:06:02:14 - 00:06:05:03
for these are as follows.

00:06:05:20 - 00:06:09:04
So starting
at the input upload location I.D.

00:06:09:21 - 00:06:15:19
so this is the input of this is the ID
number of your upload hop folder.

00:06:15:20 - 00:06:19:19
So remember we looked at the two IDs
for our folders when nine and ten

00:06:20:11 - 00:06:22:27
nine was the one which is I want to

00:06:22:27 - 00:06:27:08
which I want to upload all CSV files to.

00:06:27:27 - 00:06:30:13
We then have the output folder ID.

00:06:30:29 - 00:06:35:20
So this is the one where the
processed csv will be placed.

00:06:37:13 - 00:06:39:27
We have customer CSV column name.

00:06:41:00 - 00:06:45:26
So this specifies
the column within the CSV

00:06:45:26 - 00:06:50:02
which contains the customer identifier.

00:06:50:17 - 00:06:53:08
If you don't put anything in here
because it is optional,

00:06:53:15 - 00:06:55:20
then this will default
to the value of customer.

00:06:56:16 - 00:06:59:17
And I'll actually show you
this CSV in a moment.

00:07:01:22 - 00:07:04:00
We then have find customer buy.

00:07:04:00 - 00:07:09:15
So this specifies the identifier you wish
to use to locate specified customers.

00:07:10:06 - 00:07:12:12
So you can use a few different options
in here.

00:07:12:12 - 00:07:14:25
It could be the ID number or just ID

00:07:16:00 - 00:07:19:29
email username or guid.

00:07:19:29 - 00:07:23:11
In our case, I'll just use email
as that's the identify we want to utilize.

00:07:23:23 - 00:07:27:05
And also it will default to email
if no entry is supplied in

00:07:27:05 - 00:07:34:19
here,
we then have a amount CSV column name.

00:07:36:08 - 00:07:37:27
So this specifies the column

00:07:37:27 - 00:07:41:09
containing the new budget amount
in your CSV file.

00:07:41:20 - 00:07:46:16
And again, this will default to the name
of amount if no entry is supplied.

00:07:46:27 - 00:07:51:05
And again,
I'll show you the CSV file in a moment.

00:07:51:18 - 00:07:52:08
So coming down

00:07:52:08 - 00:07:54:26
a little bit further here,
we have the top up mode.

00:07:55:12 - 00:07:58:14
So you can set this between a value of one
and three

00:07:59:10 - 00:08:02:14
with one, two or three
each performing different actions.

00:08:03:17 - 00:08:06:15
So if we have one specified in here,

00:08:06:15 - 00:08:10:00
all valid customers will get the amount
that is specified

00:08:10:00 - 00:08:14:12
in the CSV to their entry
added to their current budget.

00:08:16:04 - 00:08:17:19
And this is regardless of the budget

00:08:17:19 - 00:08:20:13
that they already have.

00:08:21:12 - 00:08:24:15
If we have two written here,
if the customer's budget

00:08:24:15 - 00:08:28:16
is greater than or equal to that,
that's that specified in this CSV.

00:08:28:28 - 00:08:31:12
The update for that
customer will be skipped.

00:08:31:22 - 00:08:32:11
So i.e.

00:08:32:11 - 00:08:38:04
the minimum budget for that customer
is the amount listed in the CSV.

00:08:38:15 - 00:08:42:15
And then if we put three in here,
regardless of their current budget,

00:08:42:24 - 00:08:46:20
the customer budget will be updated
to match that shown in this CSV

00:08:50:19 - 00:08:52:23
And then we have send emails.

00:08:52:23 - 00:08:56:08
So this sends email notifications
to a customer once

00:08:56:08 - 00:08:58:11
their budget has been updated.

00:08:58:11 - 00:09:01:24
If you set it to true by otherwise,
if you don't want emails sent out

00:09:02:18 - 00:09:04:17
sent, that's a false

00:09:07:02 - 00:09:08:08
once that's been configured.

00:09:08:08 - 00:09:11:12
Click on save.

00:09:12:11 - 00:09:15:08
Next, we're going to navigate
back to our Hot Folders

00:09:15:23 - 00:09:16:27
section

00:09:22:11 - 00:09:24:12
and the process we're going to do. Now.

00:09:24:12 - 00:09:27:13
Everything is configured, so we're just
going to actually test this process.

00:09:27:13 - 00:09:31:18
We're going to upload some CSV files
to the particular folder

00:09:31:27 - 00:09:33:29
and watch the process take shape.

00:09:34:28 - 00:09:38:24
So if I go to manage
content on my input file,

00:09:38:24 - 00:09:44:10
so my input folder,
so what I've named Budget.

00:09:44:10 - 00:09:48:17
Now all we want to do is drag
and drop our CSV files into here.

00:09:49:10 - 00:09:49:29
Now let's show you

00:09:49:29 - 00:09:52:07
the format of those required CSV files.

00:09:52:29 - 00:09:55:28
It's as simple as this you've got

00:09:55:28 - 00:09:57:10
with a comma delimiter.

00:09:57:10 - 00:09:59:16
You've got to two columns.

00:09:59:16 - 00:10:03:05
The left one is what you're using
to identify the customer,

00:10:03:15 - 00:10:06:05
and the right is what you're using
to identify the amount

00:10:06:21 - 00:10:09:24
and then all the subsequent lines
are just going to have your identifier,

00:10:10:23 - 00:10:14:22
a comma,
and then the amount you want to amend

00:10:14:22 - 00:10:17:26
that budget
by based on your chosen method.

00:10:18:25 - 00:10:20:28
Now you can upload more than one
file at once

00:10:20:28 - 00:10:23:08
if you have it spread over
multiple CSV files.

00:10:25:02 - 00:10:29:00
So for example, I have two CSV files
that we can utilize here.

00:10:29:25 - 00:10:31:25
I'm just going to drag and drop those

00:10:34:28 - 00:10:36:22
into this folder.

00:10:37:00 - 00:10:41:19
You'll see they're uploaded and then we've
set an interval of 2 minutes now.

00:10:41:19 - 00:10:45:14
Okay, so every 2 minutes
that script will be run in the background

00:10:45:25 - 00:10:49:28
and those CSV files should be processed.

00:10:55:26 - 00:10:56:06
So by

00:10:56:06 - 00:11:00:04
refreshing our folder, I can see that it's
now empty.

00:11:00:04 - 00:11:02:19
Those files have been processed.

00:11:02:19 - 00:11:05:05
And if I go and navigate
to our other folder,

00:11:05:10 - 00:11:07:17
which is the processed budget in my case

00:11:08:28 - 00:11:12:02
and what we specified
as the output in our Megascript,

00:11:12:13 - 00:11:16:17
we can see here that we have those two
sample files that I uploaded, but

00:11:16:17 - 00:11:20:12
I've now been given the suffix of process
to show that they've been successful.

00:11:20:27 - 00:11:26:08
Alternatively, if they hadn't
been successful, it would say failed.

00:11:26:29 - 00:11:30:01
Now we can further verify
that this has worked by actually viewing

00:11:30:01 - 00:11:32:19
our customers, by

00:11:36:01 - 00:11:38:09
clicking on the Budgets tab.

00:11:38:09 - 00:11:41:08
And we can see that the budget amount
has been updated

00:11:41:19 - 00:11:44:06
based on what was in the CSV.

 

Incomplete
Step by Step Guide

GT_GEN_007

Here, we will learn how to set up and utilise functionality allowing the automatic updating of customer budgets.

Once configured, this functionality allows CSV files uploaded to a Hotfolder to be read and then automatically update customer budgets via a MegaScript.

Creation Date: Aug 16, 2023
Created By: Sam Webster

1. Navigate to Customer Management

To begin, we will take a look at our customers.

Navigate to Customer Management

2. Customer data

The MegaScript (seen later) can be configured to check for various customer identifiers, such as "id", "email" or "username".

Ensure that your customer accounts have the required data included.

In our example, we will reference the email identifier.

Customer data

3. Navigate to Hotfolders and Print Locations

Next we will ensure the required Hotfolders are configured.

Navigate to Hotfolders and Print Locations

4. Create Hotfolders and note their Ids

Two Hotfolders are required for this functionality.

One will be the upload location for our budget CSV files, the other will store processed files once the MegaScript has run (for reference purposes).

Whilst "Budget" and "ProcessedBudgets" are appropriate names, you can name these Hotfolders as you wish.

Note down the Ids for the two Hotfolders, as these need to be input into the MegaScript.

In our example, we have Ids of 7 and 8.

Create Hotfolders and note their Ids

5. Navigate to MegaScripts Management

Navigate to MegaScripts Management

6. Enable Budget

Enable Budget

7. Click on Save

Click on Save

8. Navigate to MegaScripts Instances

Navigate to MegaScripts Instances

9. Select Budget from the dropdown and click Create

10. Click on Create

Click on Create

11. Complete the MegaScript selection options

Give the instance a name and ensure it is enabled. Also allow PurgeManually i.

Please note, if your Megascript fails for whatever reason then it will automatically disable. You will need to navigate back here and Enable again to retry.

If you wish to trigger the script manually, select PurgeManually.

If you wish for the script to run automatically in the background, enable RunBackground and specify an interval in which this script will run.

Complete the MegaScript selection options

12. Input the MegaScript configuration into the Configuration input

Copy the code below into the Configuration input box.

This code should be amended to suit your specific setup / requirements.

Values are as follows:

  • inputUploadLocationId | Input the Id of your upload Hotfolder

  • outputHotFolderId | Input the Id of your "processed" Hotfolder. This is optional. If configured, Infigo will move processed budget files here with the relevant suffix of "processed" or "failed".

  • customerCsvColumnName | Specifies the column containing customer identifier in your CSV file. This defaults to 'customer' if no entry is supplied.

  • findCustomerBy | Specifies the identifier you wish to use to locate specific customers. You can use "id", "email", "username" or "guid". This defaults to 'email' if no entry is supplied.

  • amountCsvColumnName | Specifies the column containing the new budget amount in your CSV file. This defaults to 'amount' if no entry is supplied.

  • topUpMode | Can be set between 1 and 3, with each performing different actions.

    • 1 | All valid customers will get amount from the csv specific to him to the budget, regardless of the budget they already have.

    • 2 | If the customer's budget is greater than or equal to that specified in the CSV, the update for that customer will be skipped. I.e. the minimum budget for that customer is the amount listed in the CSV.

    • 3 | Regardless of their current budget, the customer budget will be updated to match that shown in the CSV.

  • sendEmails | Send email notifications to a customer once their budget has been updated.

{
    logLevel: 4,
    targetAudience: {
        type: 3,
        data: {
		    inputUploadLocationId: 7,	    
		    outputHotFolderId: 8,
		    customerCsvColumnName: "customer",
		    findCustomerBy: "email",
		    amountCsvColumnName: "amount",
		}
    },
    topUpMode: 1,
    amount: 150,
    sendEmails: false
}
Input the MegaScript configuration into the Configuration input

13. Click on Save

Click on Save

14. Navigate to Hotfolders and Print Locations

Navigate to Hotfolders and Print Locations

15. Click on Manage content for your Budget folder

Click on Manage content for your Budget folder

16. CSV format

Your CSV format should be as shown in the screenshot below.

The first row should be your headers for the customer and corresponding budget amount.

Subsequent rows should contain the relevant customer identifier and the budget amount.

For example:

customer,amount
customer1@inf.igo,1000
customer2@inf.igo,2000
customer3@inf.igo,3000

Save these files as CSV's.

CSV format

17. Return to your Hotfolder "Manage Content" screen

Drag and drop the CSV files into the upload area.

A pop up will display their successful upload.

Return to your Hotfolder "Manage Content" screen

18. When your MegaScript runs, the Budget folder should show as empty

When your MegaScript runs, the Budget folder should show as empty

19. The uploaded CSV files will instead be shown in the Processed Hotfolder with the relevant suffix.

The uploaded CSV files will instead be shown in the Processed Hotfolder with the relevant suffix.

20. Navigate to one of your customer accounts and click Budgets

Navigate to one of your customer accounts and click Budgets

21. The customer budget from the CSV will now be displayed and applied.

The customer budget from the CSV will now be displayed and applied.
Alternate Search Terms