PHP Push notification workflow rule example

From DreamFactory
Jump to: navigation, search
DreamFactoryTutorialsPHP Push notification workflow rule example

This script uses a pre-configured push notification service to send notifications when new records are created.

// POST /api/v2/db/_table/todo triggers script db._table.todo.post.post_process
// This script runs AFTER records are written to the db.

$payload = \Request::json()->all();

DreamFactory\Core\Utility\ServiceHandler::handleRequest(
        'POST',
        'push',
        'topic/arn:aws:sns:us-east-1:xxxxxx:new_todo',
        [],
        [
            "Message" => "A new Todo named ".$payload['name']." was just created.",
            "Subject" => "New Todo Created",
        ]
    );