Gentics Mesh Must Read Plugin

Gentics Mesh Must Read Plugin

Description

Do you want to broadcast messages to all your users and want to make sure that everyone has read them?

With the must read plugin you can configure a list of nodes that are initially unread for every user. Via the API you can then mark them as read when your user has seen it, so that the user won’t see the node again.

Documentation

This plugin provides endpoints to fetch all nodes that must be read and to set specific nodes to be already read.

Installation

Note
Make sure to only use commercial plugins which match the Major and Minor version of the Gentics Mesh server. Plugins which do not match may not be compatible with the Gentics Mesh version.

Commercial plugins can be downloaded from our maven site. Alternatively you can also use maven to download the jar:

mvn dependency:get \
  -Dartifact=com.gentics.mesh.plugin.commercial:mesh-mustread-plugin:$YOUR_MESH_VERSION \
  -DremoteRepositories=gtx-commercial::default::https://maven.gentics.com/maven2-commercial \
  -Ddest=mesh-mustread-plugin.jar -Dtransitive=false

If you get an "Unauthorized" error, please locate your maven settings (usually found in ~/.m2/settings.xml) and add our server to the servers list:

settings.xml
<settings>
 ...
 <servers>
    <server>
      <id>gtx-commercial</id>
      <username> $YOUR_USER_ID </username>
      <password> $YOUR_API_KEY </password>
    </server>
 ...

Once downloaded, place the jar file, optionally together with a config file and other assets, in the configured plugins folder of your Mesh installation — then the plugin(s) will automatically be deployed during server startup.

Setup

Copy the jar file and the config directory into the plugin directory of your mesh Installation. Modify the config.yml and storage/graphql/* files to your liking.

Configuration

Config.yml

The config file allows you to customize the behaviour of the must read plugin. The projects array allows you to define several project for which the must read plugin is active.

NodeListParameterName

With this parameter you define the name for the field containing the uuids that are read for the unread endpoint. If you leave it blank the default value uuids is used

Projects

You can define the following parameters for each project:

  • name: Name of the Mesh Project the plugin is active

  • folderName: Name of the folder where the plugin stores it’s informations

  • queryFiles: Configuration for the used queryfiles

    • uuid: GraphQL file that fetches the ids of the nodes that mus be read

    • data: GraphQL file that fetches the data you want to receive when accessing the /unread endpoint. This GraphQL file gets the variable $uuids provides by the module to fetch the data for the unread nodes

  • FieldNames: Names for the specific fields the module should use

    • uuid: Name of the field in the MustReadGrapQLFile that stores the uuid. If you don’t specify it or specify it empty the plugin assumes you meant uuid

    • published: Name of the fields in the MustReadGraphQLFile that stores if the current entry is published or not. If you don’t specify it or specify it empty, the plugin assumes you meant isPublished

The must read plugin only activates for projects which are defined in the config.yml and have FolderName, queryFiles/uuid and queryFiles/data set

Endpoints

Read

  • Method: Post

  • Data: Key (named like NodeListParameterName) containing the uuids that should be marked as read

This endpoints sets the provided uuids as read so that the unread endpoint ignores them for the currently logged in user

Unread

  • Method: Get

  • Data: Provides a json with the data for all the unread nodes for the currently logged in user. The structure is defined by the dataQueryFile configuration option of the project

Returns the data for the nodes that are unread by the currently logged in user.

Plugin Details

The plugin includes developer documentation, but does not provide a management user interface.

Interested?

Version

2.0.18

License

commercial

Authors

Gentics