Xomlo.io
  • Using Xomlo.io SDK
    • Getting started
    • Payload
    • Working with the filesystem
    • Configuration file
    • SDK Reference
    • Deploy connector & using API
    • Introduction to models
  • Model reference
    • Slack
Powered by GitBook
On this page

Was this helpful?

  1. Using Xomlo.io SDK

Introduction to models

PreviousDeploy connector & using APINextSlack

Last updated 3 years ago

Was this helpful?

If you understand the basics of creating your own connectors, we can take a deep dive into another topic - models. A model is an abstraction over individual apps and services. It provides both interfaces for how the data looks like, and methods for the communication itself. We always find the best way to communicate with the application, which could be REST API, XML files, working with a database, and more... Every app or service has its own model which is provided as a standalone npm package and has its own reference package with all information needed.

In this example, we will use the . You can import it by running the following command inside your terminal:

$ yarn add @xomlo/xomlo-models-slack

All models are provided as a class which could be used like this:

import { functions } from "@xomlo/xomlo-sdk";
import { Slack } from "@xomlo/xomlo-models-slack";

functions.main(async () => {
    const slack = new Slack(...);
});

Then you can use all methods specified in the reference. For example:

const slack = new Slack(...);
await slack.sendMessage('channel', 'Hello world!');
Slack model