Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to handle system to system notification #18

Open
hb7777 opened this issue Feb 6, 2017 · 0 comments
Open

API to handle system to system notification #18

hb7777 opened this issue Feb 6, 2017 · 0 comments

Comments

@hb7777
Copy link

hb7777 commented Feb 6, 2017

I also created an API to handle system to system notification. It works by first creating an entry in the DS system->Notifications->notifications. For example :

Title :  Account Creation confirmation

Presentation content: 

<p>Bonjour,&nbsp;</p>
<p>La cr&eacute;ation de votre compte Ville de Montr&eacute;al est presque compl&eacute;t&eacute;e, il ne vous reste qu'&agrave; confirmer le tout!</p>
<p>Cliquez sur ce lien ou copiez-le dans votre navigateur : {{urlvdm}}.</p>
<p>Ce lien ne peut &ecirc;tre utilis&eacute; qu'une seule fois. Vous pourrez ensuite vous connecter avec votre adresse de courriel et le mot de passe que vous aurez choisi.</p>
<p>Cordialement,&nbsp;</p>
<p>L'&eacute;quipe de la Ville de Montr&eacute;al</p>

I would also create a generic template to use when using the email channel for my transport. Example :

<table>
<tbody>
<tr style="background-color: #323232;">
<td style="width: 20%; color: #ff0000;">
<h2>Ville de Montr&eacute;al - Notification</h2>
</td>
<td style="color: #ffffff;">
<h4>{{Title|raw}}</h4>
</td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td style="width: 25px;"></td>
<td>{{Message|raw}}</td>
</tr>
</tbody>
</table>

Each method in the API would handle a specific type of notification, and therefore received a different set of parameters via a json input base on the need of that notification. The method would also receive the transport profile to use, and would also make a pre-rendering (twig variables) of the notification content with the received input before saving the render version in the message entity. Once in the transport class we simply replace the Twig variable {{Message|raw}} with the render content in the message entity passed to the transport class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant