Step 2: Creating Your First Integration

What you will accomplish

In this tutorial you will assemble an integration that pulls a list of "ToDo" tasks from JSON Placeholder, computes the number of tasks that are marked 'complete' using JSONata syntax, and sends a status message to a Slack channel.

Prerequisites

  1. To run this integration, you will need to generate a Slack webhook.
  2. If you have not yet, please complete the previous setting up tutorial prior to this one.

Create an integration

You can create an integration via the web app or through the Prismatic CLI tool. If this is your first time using Prismatic, we recommend using the web app to get a visual understanding of how integrations are assembled.

  1. Create a new integration. Click Integrations from the left-hand sidebar, and then click + Integration in the upper-right. Give the integration the name My First Integration with a description of your choosing.

  2. After creating your integration, you will find yourself in the integration designer screen. Add an HTTP GET action by searching for HTTP in the Add an action search box and select HTTP - GET Request.

    Enter the URL https://jsonplaceholder.typicode.com/todos in the URL field in the Step config - httpget pane, and keep Response Type as json.

  3. Add another action by clicking the icon under the httpget action card. This time choose the Slack - Slack Message action.

    Enter your Slack webhook in the Webhook URL input box. In the Message input box click the icon once to enter JSONata mode, and enter this expression:

    $count(outputs.httpget.all[completed]) & " of your " & $count(outputs.httpget.all) & " tasks are marked complete."

Test the integration

Now it's time to test your integration to verify it works properly. Like creating the integration, you can do this via the web app, or in your terminal.

The bottom-right portion of the integration designer is the testing pane. Test your integration by tapping the RUN TEST button on the top right of that pane.

When the test is complete, a message should be posted to the Slack channel you previously configured.

Next Steps

Congratulations! You created your first integration! Here are a few things you should try next:

  • Toy around with JSONata inputs, to alter the Slack message you're generating
  • Swap out the HTTP GET action for a different data source component (perhaps pull from an SFTP server)?
  • Post data to a REST API instead of Slack with a HTTP POST action

When you are ready, move on to the next tutorial to create customers, deploy your integration, add alerting, and more.

Last updated on