Sending Notification to be displayed in CCP

This example shows how to send control panel notifications from the application backend through the notification manager as described in the notification concepts.

<?php
  ...
     $notification = new \APS\Notification;
     $notification->message = new \APS\NotificationMessage("VPS Creation");
     $notification->details = new \APS\NotificationMessage(
     "VPS __name__ is provisioned",
     array("name" => $this->name)
     );
     $notification->accountId = $accountId;
     $notification->status = \APS\Notification::ACTIVITY_READY;
     $notification->packageId = $this->aps->package->id;
     $notification->link = new \APS\NotificationLink(
     "/v/aps/samples/async1pn/servers/",                      // Main link
     "/v/aps/samples/async1pn/server-edit/r/".$this->aps->id, // Link more
     "View or edit VPS"                                       // Link more text
     );

     // Send the notification
     $notificationResponse = $notificationManager->sendNotification($notification);

     // Store the notification ID as the VPS property to update or remove it in other operations
     $this->notificationId = $notificationResponse->id;