PrivateContent Data Bridge add-on

Documentation for v1.0 and later


Introduction

Before going through documentation chapters, thanks for purchasing PrivateContent Data Bridge add-on and trusting LCweb!

Need further help?

Open a ticket

Need a customization?

Ask for a quotation

Installation

License Activation

On first plugin's activation, it must be activated in order to work.
Head to the LCweb Dashboard page: it contains the summary of all LCweb products with useful links and their validation forms.

LC WP Dashboard

LCweb Shop License:

Your license is automatically registered into the LCweb database, you only need to

  1. go to your licenses dashboard and select the section your product belongs to (if you own only one product, you will be automatically moved)
  2. Scroll down until you find the license you want to use for the website and click on the pencil button
  3. Insert the website domain and save. The system will give you the activation token
  4. Copy and paste it into the LCweb dashboard, on your website

In case you have an intranet or localhost website (or your server is blocking external communications against the LCweb endpoint) you can use the offline activation.

Click on the related link (in the LCweb Dashboard) and fill in the form with the requested data: the offline token can be found following the steps listed above.

Site Keys and Logs Tracking

The add-on is based on data exchanges between servers: Site Keys are the basis to authenticate calls coming from third-party systems and ensure security. Each site key can be disabled or renamed. They are required in order to use incoming webhooks and the Zapier integration.

Logs tracking

Since the add-on acts totally under the hood autonomously performing operations, is strongly suggested to enable the logs system in order to have a trace of actions performed and their response.

logs tracking

Incoming Webhooks

What is a webhook? Is simply an URL you can call through a third-party system to perform actions. In this case, the add-on dynamically generates URLs to let you create/update/delete users or also retrieve users data.

In order to use this system is mandatory to have basic knowledge of how HTTP calls works.

In the following sub-chapters you will understand how to deal with each add-on function relatd to them.
Is mandatory to use site keys in order to sign incoming calls.

The engine users WordPress REST functions to create the endpoints and give responses in JSON format. You will find an example of returned data in case of successfull call (HTTP status 200) in each sub-chapter, while this is an error response sample (HTTP status 40x) related to missing site key:

{
    "code": "rest_missing_callback_param",
    "message": "Missing parameter(s): site_key",
    "data": {
        "status": 400,
        "params": [
            "site_key"
        ]
    }
}

Once created, you can copy the webhook URL and toggle them directly in the interface

Get User Data

REQUIRED STEPS

  1. Is mandatory to have a dedicated handled parameter to match the user ID/username/e-mail
  2. Choose which user fiels to output

 

SAMPLE RESPONSE

{
    "id": "965",
    "username": "demo_user",
    "categories": [
        "9",
        "18"
    ],
    "tel": "454243"
}

Create User

REQUIRED STEPS & NOTES

  1. Is mandatory to have at least three parameters for username, password and e-mail
  2. Assign the handled parameters to the required user fields
Data validation
Values are validated by the PrivateContent form engine: each field value must comply with the required validation parameters
User Categories

Unless the categories field is involved in the data assignment wizard, the new user will be assigned to the "Default category for registered users" defined in PrivateContent settings

Using a parameter to assign the categories, it must be an array composed by user category IDs.

Optional parameters assignment
You might want to set an optional parameter to be handled and fill a user field with its value. In case the parameter is not found, the user field will be filled with an empty value

SAMPLE RESPONSE

{
    "success": true,
    "message": "User successfully created!",
    "user_id": 966
}

Update User

REQUIRED STEPS & NOTES

  1. Is mandatory to have a dedicated handled parameter to match the user ID/username/e-mail
  2. Choose which user fiels to update and how to fill them
Data validation
Values are validated by the PrivateContent form engine: each field value must comply with the required validation parameters
User Categories
Using a parameter to assign the categories, it must be an array composed by user category IDs
Data manipulation

Multiple-option or numeric fields have got specific options to manipulate the user values.

Is possible to add/remove specific values for multi-options (eg. assigning a new user category). Is possible to increase/decrease numeric ones by a specific amount (eg. create a counter and increase the number by 1)

Optional parameters assignment
You might want to set an optional parameter to be handled and fill a user field with its value. In case the parameter is not found, the user field will be filled with an empty value

SAMPLE RESPONSE

{
    "success": true,
    "message": "User successfully updated!",
    "user_id": 966
}

Delete User

REQUIRED STEPS

  1. Is mandatory to have a dedicated handled parameter to match the user ID/username/e-mail

 

SAMPLE RESPONSE

{
    "success": true,
    "message": "User successfully deleted!",
}

Outgoing REST Calls

What is a REST call? Without going too deep into technicisms, this is the standard to share data between systems.
Essentially your website will perform an HTTP call to a defined endopoint URL, deesigned to receive and elaboarte the data.

This system performs REST calls whenever PrivateContent users perform targeted actions and send targeted user data to the remote endpoint.

In this video:

  1. The endpoint URL is called whenever the user is updated by admins, through the user dashboard
  2. Sends out an additional value (normally third-party systems requires a key to authenticate you)
  3. Performs the automation only if user is edited in the morning (before 11AM)
  4. Performs the automation only if user has got a specific category
Event parameter conditions (optional parameter)
Certain events have got specific parameters to allow you triggering the call on specific cases. For example, in relation to File Manager add-on you can perform the call only if user uploads a file on a targeted field
Target user conditions (optional parameter)
Is useful to perform calls only for targeted users

Once created, you can toggle the REST Calls or also test the endpoint sending out demo data

Update User on Action

This system updates/manipulate user's data after a targeted action related to him has been performed.

In this video:

  1. The automation is performed whenever a user purchases a product through WooCommerce
  2. Performs the automation only if the purchased product ID is equal to a specific value
  3. Performs the automation only if user has not got a specific category
  4. Assigns two new categories to the user
Data validation
Values are validated by the PrivateContent form engine: each field value must comply with the required validation parameters
Event parameter conditions (optional parameter)
Certain events have got specific parameters to allow you triggering the call on specific cases. For example, in relation to File Manager add-on you can perform the call only if user uploads a file on a targeted field
Target user conditions (optional parameter)
Is useful to perform calls only for targeted users

Zapier Integration

The add-on enables the official, native, integration with Zapier.
In other words, you will be able to get user data or create/update/delete user after a zap has been executed or trigger a zap once a PrivateContent user performs targeted actions.

The first step is to control the "Enable Zapier endpoints?" toggle in the PrivateContent settings > Data Bridge tab.

In order to use this system, you must join the PrivateContent integration on Zapier by reaching this link:
https://zapier.com/developer/public-invite/191372/0033ee98f203af4df716e4aac61988a1/

Use PrivateContent Actions to Trigger Zaps

  1. Create a new Zap and search for PrivateContent among the apps
  2. In the first step you will be prompted to connect with your website.
    Click on the related button and insert your website URL + an active site key. If you already connected in the past, you can use the existing connection.
  3. Once connected, move to the "configure" step and
    1. Insert a unique Zap ID for your website
    2. Choose which PrivateContent actions will trigger the zap
    3. Choose who has to perform the action in order to fire the trigger or which user status to target
  4. Move to the "test" step. Testing the connection, your website will return a list of available fields. They will be usable to configure further zap actions. In case you create new fields, you must edit the zap and perform again this step in order to re-fetch the available fields.
  5. Once the zap is enabled you can go in the Outgoing REST Calls page to see it among the automations list

 

Perform PrivateContent Actions on Zaps Execution

  1. Create a new Zap and choose whatever trigger you prefer, then create a new action and search for PrivateContent among the apps
  2. In the first step you will be prompted to connect with your website.
    Click on the related button and insert your website URL + an active site key. If you already connected in the past, you can use the existing connection.
  3. Once connected, move to the "configure" step to see the available fields (related to your website) to create the user. In case you create new fields, you must edit the zap and perform again this step in order to re-fetch the available fields.

    In case of user update, deletion or if you want to retrieve user data you will be prompted to specify which field to match the user by (ID, username, e-mail) and to specify the matching value

  4. Move to the "test" step and publish. You can also run the step test but please be careful: you will truly access the database on your website.

Multilanguage

The add-on is 100% multilanguage. If a translation of your language has been created, WordPress will automatically switch between languages

How to create a translation

If you have WPML + String Translation add-on or Polylang, you can simply scan the plugin and translate strings via its UI.

Otherwise: go in the plugin folder, you'll find a folder called "languages".
Inside you'll find the default.pot file. It contains english strings to be translated.

If you want to create or customize your language translation, follow these steps:

  1. Open the default.pot file with POedit
  2. Edit the catalog by inserting your data and setting translation's language
  3. Save the file with your language's i18n identifier and "pczw_ml-" prefix (the italian example is pczw_ml-it_IT)
  4. Go to the plugin folder ".. wp-content/plugins/private-content-data-bridge/languages" and paste resulting .PO and .MO files

If you create new translations, please get in touch at [email protected] sending your .PO and .MO files.
Otherwise they will be lost in next updates. Thanks!