WHMCS / developer-docs

Developer documentation portal content
72 stars 114 forks source link

TriggerNotificationEvent - incorrect example for passing attributes to localApi call #287

Open Makinami opened 1 year ago

Makinami commented 1 year ago

In localApi example, attributes are passed same as in over the network call, while they should be defined as regular PHP array. https://developers.whmcs.com/api-reference/triggernotificationevent/

Working example:

// ...
$postData = array(
    'notification_identifier' => 'custom.server.add',
    'title' => 'New Server Added',
    'message' => 'new-server.examplehost.com added as a cPanel server and is available for provisioning.',
    'url' => 'https://whmcs.example.test/admin/configservers.php?action=manage&id=3',
    'status' => 'Success',
    'statusStyle' => 'info',
    'attributes' => [
        [
            'label' => 'example',
            'value' => 'example',
            'url' => 'https://whmcs.example.test/admin/configservers.php?action=manage&id=3',
            'style' => 'success',
            'icon' => 'example',
        ],
    ],
);
// ...