Links

Emitting Messages

There are two ways to emit messages:
  1. 1.
    Emit using the SDK for internal apps or services
  2. 2.
    Emit using Connections for third-party integrations

Emit using the SDK

Step 1: Create a Secret Key

  1. 1.
    Head over to the Secret Keys section on the Settings page
  2. 2.
    Click the + Create secret key button
  3. 3.
    Name your Secret Key
  4. 4.
    Click Create
Ensure you store the test and live keys somewhere safe (like a password manager).

Step 2: Emit your message

Buildable lets you turn any internal app or service into a message emitter. To emit a message from an internal app, you can use Buildable's easy-to-use SDK.
To start, install the NPM package:
npm install @buildable/messages
Then, initialize the SDK and emit your message with its payload:
import { createClient } from "@buildable/messages";
// Init your Web SDK
const client = createClient(process.env.BUILDABLE_SECRET_KEY);
// Emit Message
client.emit("user.created", user);
# Using cURL
curl --location --request POST 'https://events.buildable.dev/emit' \
--header 'X-Buildable-Secret: <YOUR SECRET KEY 🤫>' \
--header 'Content-Type: application/json' \
--data-raw '{
"event": "user.created",
"payload": {
"name": "John Doe"
}
}'
A message contains:
  1. 1.
    event - The name of the event
  2. 2.
    payload - The data of the event
You can create a Buildable Secret Key from your dashboard in Settings > Secret Keys
That easily, you should see messages begin to appear in your Buildable Messages Stream ⚡️

Emit using Connections

Buildable lets you turn any third-party cloud app into a message emitter. To emit a message from a cloud app, you can use Buildable's 100% open-source Connections. To do so:
  1. 1.
    Head to the Connections tab in the dashboard
  2. 2.
    Click + New Connection
  3. 3.
    Select the Connection you'd like to use
  4. 4.
    Securely enter your credentials
  5. 5.
    Click Connect
  6. 6.
    Select the event types you'd like to listen to
  7. 7.
    Click Subscribe
Once you've done these steps, you'll start to notice messages being collected automatically from your cloud app based on the activity found in the connected account! Viewing messages? Pop into the next section: