ethinking/ibexa-push-connector

v3.1.2 2020-11-18 12:33 UTC

This package is auto-updated.

Last update: 2020-11-18 12:36:45 UTC


README

The Push Delivery Connector from ethinking GmbH lets you enhance your ibexa DXP experience with providing access to new ways of reaching your customers using your content. It establishes the possibility to send push notifications to various platforms from the inside of your CMS. The connector will provide its own tabs next to the admin section to let your CMS admin easily set up all necessary connections. Moreover, it is designed to create and alter distribution channels or push templates.

Installation

The recommended way to install a library is via composer:

composer require ethinking/ibexa-push-connector

Preparation

  1. Create ezplatform_push_connector.yaml in the config/routes/ with the next code:

    ezplatform_push_connector:
      resource: "@EzPlatformPushConnectorBundle/Resources/config/routing.yaml"
      prefix:   /
  2. Create push_mapping.yaml in the config/packages/ with the format:

    ezplatform:
        system:
            admin_group:
                push_config:
                    content_types_map:
                        article:
                            webpush:
                              fields:
                                title: '<title_content_field>'
                                message: '<message_content_field>'
                              enabled: true

    This maps the fields in content to be pushed with the push payload.

    Import this yaml file in config/packages/ezplatform.yaml

    Important Replace <title_content_field> and <message_content_field> with the identifier of respective content fields. Currently we support Textline / ezstring field types. (https://doc.ibexa.co/en/1.13/api/field_type_reference)
  3. Run the script in MySQL database

    create table push_delivery_main_settings
    (
     settings_id INTEGER NOT NULL DEFAULT 1,
     domain VARCHAR(50) NOT NULL,
     client_id VARCHAR(50) NOT NULL,
     username VARCHAR(50) NOT NULL,
     password VARCHAR(50) NOT NULL,
     created_on DATETIME NOT NULL,
     updated_on DATETIME NOT NULL,
     CONSTRAINT PK_PUSH_DELIVERY_MAIN_SETTINGS PRIMARY KEY(settings_id)
    );
  4. Add embed code placeholder into your twig template for frontend

    {{ ibexa_push_connector_embed_code() }}
  5. Update assets

    yarn encore dev
  6. Clear cache

    php bin/console c:c
Tip If you’re getting an error about missing dependencies in the entrypoints.json, try to delete manually "public/assets/ezplatform" directory and update assets again using command "composer install". Also make sure you have the next records in the config/bundles.php:
Ethinking\PushConnectorBundle\EzPlatformPushConnectorBundle::class => ['all' => true],
Ethinking\EthinkingPushApiBundle\EthinkingPushApiBundle::class => ['all' => true],

Configuration

After installation, a new menu item "Push" will appear in the navigation with the sub menu item "Main settings" http://YOUR_WEBSITE_URL/admin/push/mainsettings

Fill out fields on the "Main settings" page with the received information.

Create a new channel on the "Channels" page http://YOUR_WEBSITE_URL/admin/push/channel

Push history

You can review status of pushes on the archive page http://YOUR_WEBSITE_URL/admin/push/archive

Dependencies

{
    "symfony/dependency-injection": "^5.0",
    "symfony/http-kernel": "^5.0",
    "symfony/http-foundation": "^4.4|^5.0",
    "symfony/http-client": "^4.3|^5.0",
    "symfony/http-client-contracts": "^1.1.8|^2",
    "symfony/validator": "^3.4.30|^4.3.3|^5.0",
    "symfony/mime": "^4.3|^5.0",
    "ethinking/push-api": "dev-master"
}

Workflow

  1. When main settings is saved in ezPlatform, this will be used by ezPlatform for communicating with push.delivery service

  2. When a channel is created in ezPlatform:

    1. System will make sure there is always a default tag in push.delivery with sourceID 'push-connector-tag-general-<client-ID>'. If missing, this will be created

    2. App is created in push.delivery and will be connected to tag mentioned above

  3. When the ezPlatform frontend is accessed from browser, the browser will be registered for push against this tag in push.delivery

  4. When an article is pushed from ezPlatform backend, push notification is send from push.delivery to all subscribers of this tag

Caution Make sure you create only one channel with webpush platform because subscriptions will be always done against the webpush channel found by the system
@startuml
|#AAA|Browser|
start
:grant permission;
|#DDD|Firebase|
:generate device token;
|Browser|
:save settings;
|#AntiqueWhite|eZ Platform|
:registeration request;
|push.delivery|
:store device token;
stop;
|eZ Platform|
start
:Content/Articles;
|push.delivery|
:push request;
|Firebase|
:send message;
|Browser|
:notification popup;
 stop;
@endum