Thanks @RomVA RomVA for the response, to be honest, your solution did work, but I managed to achieve another one, I forgot to post here, but it may be useful for other people. I just changed
display notification "Foo foo" with title "Foo"
for
tell application "System Events"
display notification "Foo foo" with title "Foo"
end tell
it asks for permission to send an event to the system but it works just like your solution