Ad

How To Extend OctoberCMS Plugin To Send Slack Notifications?

I want to extend Magic Forms plugin to send Slack notifications at the same time with mail notification but I don't know if it is possible.

For my own plugin I'm using Slack for PHP library.

Ad

Answer

Yes I Guess you can, Just use composer for plugin add your package to plugin using composer.

then read this document https://skydiver.github.io/october-plugin-forms/docs/advanced/events/#docsNav

you need to use add Event Listeners and fire up your notification

public function boot() {

    # Listen for Record after saved
    Event::listen('martin.forms.afterSaveRecord', function (&$formdata, $component) {
        // here use your slack lib and send notification
        // $formData has all data
    });

}

if any doubts please comment.

Ad
source: stackoverflow.com
Ad