wp_insert_post with data from graph api inside a plugin

There’s no way to get notifications from Facebook for a new post. You have to check by hand. Just set a transient with the desired expire time for the data so you don’t make a request on each reload, maybe check hourly for new data or every 30 mins, up to you.

As for your second question, read the docs:

https://developer.wordpress.org/reference/functions/wp_insert_post/

It automatically assigns an ID unless provided by you (which is auto-incremented by the system) but you still need to provide more things in the array, even if some are default, you might not want it like that.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)