Is there a way to add a post in wordpress via googlescript?
<p>I have a form in googlescript where I can add a user to a sheet.
Is there a way to implement some lines in that code so the script adds a post on a wordpress page?
I read that it's possible via wp_insert_post , but I have no idea how that works in my case.</p>

<p>EDIT: 
As Spencer suggested I tried to do it via WP REST API. </p>

<p>The following code seems to be working ............. </p>

<pre><code>function httpPostTemplate() {
  // URL for target web API
  var url = 'http://example.de/wp-json/wp/v2/posts';


  // For POST method, API parameters will be sent in the
  // HTTP message payload.
  // Start with an object containing name / value tuples.
  var apiParams = {
    // Relevant parameters would go here
    'param1' : 'value1',
    'param2' : 'value2'   // etc.
  };

  // All 'application/json' content goes as a JSON string.
  var payload = JSON.stringify(apiParams);

  // Construct `fetch` params object
  var params = {
    'method': 'POST',
    'contentType': 'application/json',
    'payload': payload,
    'muteHttpExceptions' : true

  };

  var response = UrlFetchApp.fetch(url, params)

  // Check return code embedded in response.
  var rc = response.getResponseCode();
  var responseText = response.getContentText();
  if (rc !== 200) {
    // Log HTTP Error
    Logger.log("Response (%s) %s",
               rc,
               responseText );
    // Could throw an exception yourself, if appropriate
  }
  else {
    // Successful POST, handle response normally
    Logger.log( responseText );
  }
}
</code></pre>

<p>But I get the error:</p>

<blockquote>
  <p>[16-09-28 21:24:29:475 CEST] Response (401.0)
  {"code":"rest_cannot_create","message":"Sorry, you are not allowed to
  create new posts.","data":{"status":401}}</p>
</blockquote>

<p>Means: I have to authenticate first.
I installed the plugin: WP REST API - OAuth 1.0a Server
I setup a new user and got a client key and client user.
But from here I have no clue what to do : /</p>