1

My Firebase database is structured to successfully save data from HTTP POST requests, as confirmed by sending test requests directly from my Angular development app:

CreatePost(){
let body = {
  "host_id" : 1, 
  "uuid" : 1,
  "id" : 1, 
  "status" : "ENDED"
}
this.http.post( this.url, body )

Firebase database update result:

    -zoom
       -L1dZbBWMTIr7ojjodzg
          host_id: 1
          id: 1
          status: "ENDED"
          uuid: 1

However, with the same database URL used as WebHook endpoint for a 3rd party service (Zoom conferencing), the database is not updating in response to WebHook triggering events, such as starting a meeting.

The Zoom WebHook POST is being sent correctly, as confirmed by a test to RequestBin:

    FORM/POST PARAMETERS
    host_id: w_1a9RDvTKqiG_BBdV7kuw
    status: STARTED
    id: 3544245503
    uuid: oJ+nrTm7Rwq1NYlpML7W/Q==

    Raw Body:
    id=3544245503&uuid=X%2F1R2AC1QS%2Btjuhxc0Kt%2Bw%3D%3D&
    host_id=w_1a9RDvTKqiG_BBdV7kuw&status=STARTED

Has anyone had experience with using Firebase for their WebHook endpoint? Does the WebHook POST need to be configured in a particular way for Firebase?

  • You may be asked to include your code that's not updating as expected. – SherylHohman Jan 13 '18 at 00:38
  • Are you sure Zoom is sending the JSON in the body of the request in the same format as your `CreatePost()` does? – Frank van Puffelen Jan 13 '18 at 03:18
  • That format looks wrong: you'll need to post a JSON object, not encoded form fields. See for example the `-d` parameter in my answer here: https://stackoverflow.com/questions/29355596/saving-data-to-firebase-with-rest – Frank van Puffelen Jan 14 '18 at 20:53

1 Answers1

3

To POST (or PUT) data to the Firebase Database in a REST request, the body of your request must contain the JSON object to be written. From the Firebase documentation:

curl -X POST -d '{
  "author": "alanisawesome",
  "title": "The Turing Machine"
}' 'https://docs-examples.firebaseio.com/rest/saving-data/fireblog/posts.json'

Your code is posting the form fields in the body as url-encoded, which is simply a different format. See this answer for a comparison of the same data in both formats: https://stackoverflow.com/a/9880122.

If Zoom doesn't have support for posting the form fields as JSON, you could consider creating a Cloud Function to do the conversion.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807