title: Firebase Cloud Messaging - Posting Message Says Invalid JSON Payload
body: <p>So I'm using jQuery Ajax to post using a bearer token that I'm having to get from someone's node.js app because I can't find Google docs on how to use your preferred language to get a bearer token for FCM use only. I'm using <code>JSON.stringify</code> to prepare the payload data which someone shows on stackoverflow here. I've tried without but I just get a basic error message of <code>Invalid_Arguments</code>. Using <code>JSON.stringify</code> shows more to the error. It's stating that <code>"to"</code> and "<code>notification</code>" properties are unknown names but those are the property names used in Google docs. So what am I doing wrong?</p>
  
  <p>Here's the link where someone says <code>JSON.stringify</code> works. Before then I tried without <code>JSON.stringify</code> which led to <code>Invalid JSON Payload</code> and my reason for asking this question.</p>
  
  <p><a href="https://stackoverflow.com/questions/39901564/send-post-request-to-firebase-cloud-messaging-by-ajax">send post request to firebase cloud messaging by ajax?</a></p>
  
  <pre><code>{
    "error": {
      "code": 400,
      "message": "Invalid JSON payload received. Unknown name \"to\": Cannot find field.\nInvalid JSON payload received. Unknown name \"notification\": Cannot find field.",
      "status": "INVALID_ARGUMENT",
      "details": [
        {
          "@type": "type.googleapis.com/google.rpc.BadRequest",
          "fieldViolations": [
            {
              "description": "Invalid JSON payload received. Unknown name \"to\": Cannot find field."
            },
            {
              "description": "Invalid JSON payload received. Unknown name \"notification\": Cannot find field."
            }
          ]
        }
      ]
    }
  }
  
  
  $.post({
              method: "POST",
              url: "https://fcm.googleapis.com/v1/projects/floridarecycling-b91ec/messages:send",
              dataType: "json",
              contentType: "application/json",
              headers: {
                  'Authorization': 'Bearer ' +
                      'ya29.c.ElqUBiCx...wyKqUqKlrg7yhPw'
              },
              data: JSON.stringify({
                  "to": "user_token",
                  "notification": {
                      "title": "Test",
                      "body": "test"
                  }
              })
              success: function () {
                  console.log("Success")
              },
              error: function (err) {
                  console.log("error ", err)
              }
          });`
  </code></pre>