The Octave Developer Hub

Welcome to the Octave developer hub. You'll find comprehensive guides and documentation to help you start working with Octave as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

POSTing Data via Webhooks

You can interface Octave with Webhooks exposed by external cloud services.

This is accomplished using the Octave.Http.* methods of the Octave Cloud API such as HTTP POST within your Cloud Actions, to send and receive data via webhooks exposed by those external cloud services. These methods allow you to include all of the standard elements of a REST request such as headers, body parameters, etc. and to receive responses.

For example, the following code creates a REST request and places a stringified version of the event into the request body. The body, along with a header, are then sent to a webhook via a POST request, and the result from the request is returned:

function(event) {

   ...

    var url = 'http://httpbin.org/post';
    var postBody = JSON.stringify(event);
    var postHeaders = {
    'Content-Type': 'application/json',
    'header2': '2'
    };
    var result = Octave.Http.post(url, postHeaders, postBody);

    return {
    "js": "function(event) { return {\\"/my_company/destination\\": [event]} }"
    }
}

It's important to check the result to identify the status code in order to determine what logic to perform next in your Cloud Action. For example, if status code 201 - Created is returned, then the operation was successful, and any resources requested can be found in other fields of the result. On the other hand, if status code 202 - Accepted is returned, then a subsequent request to the webhook may be required in order to check the status of any remote processes. In this case you check the status by invoking another REST request in a different event.

Updated 10 days ago

POSTing Data via Webhooks


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.