You should use save_post
like the following:
function modifyOnPost( $post_id ) {
$post = get_post($post_id);
//do stuff here before your post is created or updated
}
add_action( 'save_post', 'modifyOnPost' );
Read more here.
Update:
To give a deeper solution you could use wp_update_post( $post, $wp_error );
inside the modifyOnPost
block to manipulate your post data.