Getting Started

You'll be up and running with Fusebit in 5 minutes!

Welcome to Fusebit!

Our product enables developers like you to quickly add integrations to an application using powerful API building blocks. It takes away the pain of developing against many disparate APIs while maintaining the flexibility and familiarity of a code-first platform. Just like Stripe solves payments for application developers, Fusebit solves integrations.

Create an Integration

An IntegrationIntegration - An integration is the place the you write your code to get things done! Written in NodeJS, an integration runs in Fusebit's secure and scalable environment to translate between the needs of your backend application and the remote service or services you're connecting to. in Fusebit corresponds to a specific task (or set of tasks) you want your application's users to be able to perform against the third-party system. An example might be a chatbot that shares updates via Slack or a task synchronizer that reflects the status of tasks to Jira issues.

The integration may have already been created for you when you create your Fusebit account, but if not, let's get started:

  1. Go to Fusebit Management PortalFusebit Management Portal - The Fusebit Management Portal enables you to easily setup and manage all your integrations in one place. Link: https://manage.fusebit.io
  2. Select New Integration
  3. Pick Slack Bot from the list and override the Name property to specify your own name
Figure 1. Creating a new integrationFigure 1. Creating a new integration

Figure 1. Creating a new integration

  1. Select Create

Run the Integration

Once the Integration has been created, you can modify its business logic. Most Integrations are created with some simple "hello world" or test functionality, that you will want to override to fit your use case.

  1. Once you create an Integration or select an existing one, you will see its detail screen. Select Edit in the middle column
Figure 2. Integration details pageFigure 2. Integration details page

Figure 2. Integration details page

  1. Instructions will display, showing how to download a local copy of the Integration code. You will need to install the Fusebit CLIFusebit CLI - https://www.npmjs.com/package/@fusebit/cli and run the fuse integration get command as shown in the Portal.
Figure 3. Integration editing instructionsFigure 3. Integration editing instructions

Figure 3. Integration editing instructions

  1. Let's first run the Integration to see what it does by default. The README.md file contains a URL that you can use to configure the integration with an IdentityIdentity - An identity is a unique relationship one of your customers has with a service. An identity can be used by multiple integrations to act on that service on behalf of your customer., so it knows which Slack user to execute commands on behalf of:
Figure 4. Integration README fileFigure 4. Integration README file

Figure 4. Integration README file

  1. Once you create an Identity, you will see instructions on how to invoke a test endpoint on the Integration using curl.
Figure 5. Integration test endpointFigure 5. Integration test endpoint

Figure 5. Integration test endpoint

  1. Once you invoke the curl command, you should see a simple test message in the Slack workspace you authorized. In the next section, you will learn how to customize your integration's logic.

Edit and Debug the Integration

Now let's modify the integration logic to tailor it to our needs:

  1. Once you have the code locally on disk, inspect the file layout. The integration.js file contains the Integration logic that you most likely want to customize.
  2. Let's change the Integration to include a user name in the message it sends, so instead of "Hello world from Fusebit!" users will see something like "Hello world from Jenny!". Modify the following function as shown:
const result = await slackClient.chat.postMessage({
  text: 'Hello world from ' + ctx.request.query.name,
  // ...
});
  1. Deploy the updated code by running fuse integration deploy as shown in the Portal.
  2. Run the Integration again using curl and see the resulting message in Slack.

If you encounter errors or want to inspect log messages as you work on your integration changes:

  1. Run the fuse integration log command as shown in the README.md file to start a real-time logs stream from your integration running in Fusebit
  2. Invoke the integration with curl. You will see the output of console.log statements in your integration's code as well as any unhandled exceptions, which is useful for debugging.

Conclusion

You now have a simple integration running in the Fusebit cloud, executing your business logic. Experiment and explore to see what you can do!

So far we've been invoking the Integration using curl, but we really want to connect it to your application backend, so the Slack Bot we created can send messages in response to real events happening in your system. Read on to find out how to start invoking your newly-created Integration from your app