🚧

Currently Javascript Only

Support for outputs is currently only supported in the Javascript SDK. Support for other platforms will be coming very shortly.

We have a handy little feature in Build called outputs that let you 'pipe' data into 3rd party applications. This means that you can take the response from any Build API and send it to things like Slack.

Let's take a look at how that works! In this tutorial, we'll consume an API on Build and send the output to a slack channel.

Things you'll need:

  1. Slack Account (1x)
  2. ReadMe Build Account (1x)

Connect Slack

To connect to Slack, go to the Settings page and click on "Connect". If it re-directs back to the settings page and the button says "Disconnect", you've successfully connected to slack.

1420

Call an endpoint and Send it to slack

Believe it or not, most of the heavy-lifting is done. To send an endpoint response to Slack all we have to do is pass a 3rd object to the run function with our desired output. Since we want to send it slack we'll pass this object: { ouput: 'slack', channel: '#general' }.

Here is how the code looks when you put it all together!

const api = require('api').config('<<keys:api_key>>');

api('math')
  .run('add', { numbers: [1, 2, 3] }, { output: 'slack', channel: '#general'})
  .then(response => {
    console.log(response);
  })
  .catch(err => {
    console.error(err);
  });

That's it. You can now pipe any response into channels in Slack!

P.S. Slack is first of many "outputs" that we're planning to add so stay tuned 😄