Minds Docs

Minds Docs

  • Docs
  • Code
  • Minds.com

›Walk-throughs

Getting started

  • Introduction
  • Installation
  • Troubleshooting

Guides

  • Architecture
  • Frontend
  • Backend
  • Mobile
  • Deployment
  • Documentation
  • Git / GitLab

Contributing

  • Contributing
  • License

Walk-throughs

  • Backend modules
  • Backend tests
  • Block
  • Frontend tests
  • Sending emails
  • Feature flags
  • Feed algorithms
  • Infinite scroll
  • Notifications
  • Postman collection
  • Mobile Internationalization
  • Mobile git workflow and CI

Handbook

  • How we work
  • Bug reporting
  • Superhero

Pro

  • Domains
  • Developers
Edit

Notifications

This guide covers how to dynamically send notifications to users when an event occurs.

Backend events and settings

Let's say we want to create a notification to send to video chat participants after a chat has completed.

In the relevant NotificationDelegate.php:

$this->dispatcher->trigger('notification', 'all', [
  'to' => [$videochat->getParticipantGuid()],
  'entity' => $hostEntity,
  'from' => $videochat->getHostGuid(),
  'notification_view' => $videochat_complete,
  'params' => [],
  ]);

Add your notification_view to PushSettings.php:

class PushSettings
{
protected $types = [
    ...
    'videochat_complete' => true,
];

Also add your notification_view to:

  • Notification/Manager.php to determine which notification category it belongs to (e.g boosts, subscriptions, votes, etc.)
  • Notification/Extensions/Push.php

Frontend template

Set up the template in notification.component.html:

<ng-template ngSwitchCase="videochat_complete">
  ...
</ng-template>

Testing

Make sure the notification dispatcher runner is running:

docker-compose exec php-fpm php /var/www/Minds/engine/cli.php QueueRunner run --runner=NotificationDispatcher
Last updated on 2019-9-20
← Infinite scrollPostman collection →
  • Backend events and settings
  • Frontend template
  • Testing
Minds Docs
Docs
Getting startedGuidesContributing
Community
Open Source Community GroupStack Overflow
More
GitLabStar
Copyright © 2021 Minds Inc.