Sending Members

To integrate your members with MMP Cloud, there are two methods:

  1. Through SFTP
  2. Calling REST API

Sending Members through SFTP

If you choose this method, MMP Cloud Administration Team will provide you sftp username and password. You can also use a key alogn with your username to login to your sftp folder.

In the root directory, there is a folder named "Upload". You must upload all your files into that directory. You can't write your files into the root directory.

SFTP method is faster than REST API method specially in full restore. The incremental speed is almost the same. Full store with SFTP for 10 million of records only takes up to 5 minutes. It may take up to 30 minutes with REST API calls.

Filename Format

You can send two types of files into the upload directory.

  1. Full Restore - This will cause replacing existing member table with the new one.
  2. Incremental - This will upsert rows in the file into the existing member table.

In order to full restore, please have a file name like the following:

member-yyyyMMddHHmmss.csv

You can also zip this file (the csv name must be preserved) and put into a zip file.

member-yyyyMMddHHmmss.zip ( it must contain member-yyyyMMddHHmmss.csv inside)

The system will unzip member-yyyyMMddHHmmss.zip and load member-yyyyMMddHHmmss.csv file in the member table.

In order to upsert incrementally, you must include -inc- keyword in the file name like the following.

member-inc-yyyyMMddHHmmss.csv

This name will have the system make upsert instead of replacing the table. You can also zip this file with the same name like member-inc-yyyyMMddHHmmss.zip

What is inside the file

There must be some pre-defined columns inside the file. These columns are case-sensitive

  1. id: This column keeps the member ids. This column is the unique primary key in the member table. This column is required and cant be left empty.
  2. email: This column keeps the email addresses. The values under this column must be RSA-encrypted with Encryption Mode(base64). The column can be left empty string.
  3. mobile_number: This column keeps the mobile number. The values under this column must be RSA-encrypted with Encryption Mode(base64). The column can be left empty string.

Important Note: Either email or mobile_number is required. In other words, you must place at least one of these columns in your file.

If other columns are required other than those required columns like name, surname, etc. these columns must be defined to the member table of the client by MMP System Administrators beforehand while creating the account.

An example file of Full Restore

name: member-20191222143005.csv

File content ( please use comma as the separator )

id,email,name,surname
100101,rsa_encrypted_email_1,rsa_encrypted_name_1,rsa_encrypted_surname_1
100102,rsa_encrypted_email_2,rsa_encrypted_name_2,rsa_encrypted_surname_2
100103,rsa_encrypted_email_3,rsa_encrypted_name_3,rsa_encrypted_surname_3
100104,rsa_encrypted_email_4,rsa_encrypted_name_4,rsa_encrypted_surname_4

Important Note: Column order in the member table is important and must be preserved in the file header. In other words, if the member table column order is like

id
email
name
surname

the uploaded files must keep the same order in the first line (as header).

Sending Members through REST API

You can send members through REST API. The REST API only supports upsert (no full restore).

Please check UpsertMember API to understand how to send memebrs via REST API to our database.

Please note that the values in all columns MUST BE ENCRYPTED before your call to REST API.

How to encrypt the values in the file

For your possible maxiumum security, you must encrypt your values in the file using RSA (encryption_mode = base64) or AES256 (we prefer using AES256 for the low cost both in cpu and disk size). We keep all values ( email, mobile_number, etc. ) encrypted in our database schemas dedicated to you so that even our own DBA's can't see these data at any time.

The memory of our servers at the time of sending is the only place we decrypt your values. In order to do this, we need your public key.

So, you (if you want, with the need of our team) create RSA asymmetric key pairs. You must use your private key to encrypt your values in the file sent over SFTP our in your calls to our REST APIs and share your public key with us through secure channels we will provide you. We will keep your public key in our secure storage ensuring that nobody even in our organisation will see your data... never!

Example code for RSA encryption

You can find an example program written in .netCore C# to encrypt the values.

private static Chilkat.Rsa rsaEncryptor = new Chilkat.Rsa();

// create encryptor
rsaEncryptor = new Chilkat.Rsa
{
	EncodingMode = "base64"
};
rsaEncryptor.ImportPrivateKey(File.ReadAllText("/mycompany/mykeys/privateKey.pem"));
// encrypt the value
rsaEncryptor.EncryptStringENC(value_of_column, true);



Example code for AES256 encryption

You can also use AES256 encryption to encrypt your values before sending to our database. This algorithm is less expensive in both cpu eusage and disk size.

KeyLenght must be 256 with Padding Scheme 0. Encoding mode must be base64.

CipherMode, ivHex and and keyHex can be configured for your own values.

Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
crypt.CryptAlgorithm = "aes";
// these parameters are static cant be changed.KeyLenght must be 256  with PaddingScheme 0 and EncofingMode base64
crypt.KeyLength = 256;
crypt.PaddingScheme = 0;
crypt.EncodingMode = "base64";

// These parameters can be changed.
crypt.CipherMode = "cbc";
string ivHex = "000102030405060708090A0B0C0D0E0F";
string keyHex = "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F";

crypt.SetEncodedIV(ivHex,"hex");
crypt.SetEncodedKey(keyHex,"hex");

// encrypt
string encStr = crypt.EncryptStringENC("The quick brown fox jumps over the lazy dog.");