PHP code example of astroshippers / notion-notification-channel

1. Go to this page and download the library: Download astroshippers/notion-notification-channel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

astroshippers / notion-notification-channel example snippets


public function routeNotificationForNotion(): array
{
    return [
        'token'    => config('services.notion.token'),
        'database' => '8e12b788392e4367b0532c9abb519133',
    ];
}

use NotificationChannels\Notion\{NotionChannel, NotionDatabaseItem};
use NotificationChannels\Notion\Properties\{Checkbox, Email, MultiSelect, Number, RichText, Status, Title, URL};

public function via($notifiable)
{
    return [NotionChannel::class];
}

public function toNotion(User $notifiable): NotionDatabaseItem
{
    return NotionDatabaseItem::create()
        ->properties([
            'Name'          => Title::make('John Doe'),
            'Email'         => Email::make('[email protected]'),
            'SomeNumber'    => Number::make(12345),
            'Tags'          => MultiSelect::make(['blah', 'blah2', 'blah3']),
            'True or False' => Checkbox::make(false),
            'URL'           => URL::make('https://developers.notion.com/reference/property-value-object'),
            'Some Text'     => RichText::make([
                [
                    "type" => "text",
                    "text" => [
                        "content" => "Some more text with ",
                    ]
                ],
            ]),
        ]);
}