Adding new blocks to Notion is very simple. Get the ID of an existing block. This can be a page, workspace or any other block in Notion.
Create a block with the function <BlockClass>::create($params...)
and append it to your parent block.
Below is an easy to modify example.
use Notion;
use FiveamCode\LaravelNotionApi\Entities\Blocks\Paragraph;
$newBlock = Paragraph::create("New TextBlock");
Notion::block($parentBlockId)->append($newBlock);
We support all available blocks from the Notion API blocks: Paragraph
, BulletedListItem
, HeadingOne
, HeadingTwo
, HeadingThree
, NumberedListItem
, ToDo
, Toggle
, Toggle
, Image
, File
, Video
, Pdf
.
You can find all block classes in this namespace: FiveamCode\LaravelNotionApi\Entities\Blocks
.