Adding Microsoft Teams Incoming Webhook to WordPress, Problem with Rest Route?

I’m not completely sure if this is the problem, but note that update_option() returns a false if the the old and new option values are the same, so you should not simply do a if ( update_option( self::$option_name, $message_data ) ) check.

So for example, you would instead do something like this:

if ( get_option( self::$option_name ) === $message_data ||
    update_option( self::$option_name, $message_data )
) {
    // your code here - send a success response and status, etc.
}

Or maybe this:

if ( get_option( self::$option_name ) === $message_data ) {
    $message="The old and new " . self::$option_name . ' values are identical.';
    return [ 'message' => $message ];
} elseif ( update_option( self::$option_name, $message_data ) ) {
    return [ 'message' => 'Successful' ];
} // else, return a WP_Error instance

Additionally, just a note that you should always include set the permission_callback argument, even for REST API routes that are intended to be public (and if it’s public, then you can use 'permission_callback' => '__return_true',).

tech