Building connectors

Define connector building blocks by capturing events with triggers, executing tasks with actions, and retrieving data with lookups.

Triggers

Triggers read data from the external application and run the related workflow in webMethods Integration.

Learn more about Triggers and how they work. The basic structure for creating a trigger with the Connector Builder is provided. You can insert your custom code to create your own triggers. For creating a polling trigger, use the provided structure:

module.exports =
{
 name: "sample_trigger",
 label: "Sample Trigger",

 input:
 {
   type: 'object',
   title: 'Sample Trigger',
   description: "Short description",
   properties:
   {
     event:
     {
       type: 'string',
       enum: ['sample_trigger']
     },
      polling: {
              type: 'boolean',
              default: true,
              options: 
                     {
                       hidden: true
                     }
                },
   }
 },

 output:
 {
   "sample_trigger":
   {
     type: 'object',
     properties: {}      
   }
 },

 mock_data: {}, // add sample output data that will be used for testing

 execute: function(input, options, output)
 {
   // will be called every 5 minutes
   // your code here
 },

 activate: function(input, options, output)
 {
   // This function will be called whenever user activates the trigger/workflow. 
  // This function is useful in scenarios where you save cursor to figure out newly added/changed data in the
  // 3rd party services. You can update your cursor so that trigger won't fetch data of the period 
  // during which the trigger was deactivated.
 },

 validate: function(input, options, output)
 {
   // This function will be called when the trigger is created. 
   // This functions validates all inputs provided by the user and sends an error if any of the details (including auth) are incorrect. In case of an error, trigger server won't create the trigger.
 }

}

If you want to create a webhook trigger, refer to the following structure:

module.exports =
{
 name: "sample_trigger",
 label: "Sample Trigger",

 input:
 {
   type: 'object',
   title: 'Sample Trigger',
   description: "Short description",
   properties:
   {
     event:
     {
       type: 'string',
       enum: ['sample_trigger']
     },
      polling: {
              type: 'boolean',
              default: false,
              options: 
                     {
                       hidden: true
                     }
                },
   }
 },

 output:
 {
   "sample_trigger":
   {
     type: 'object',
     properties: {}      
   }
 },

 mock_data: {}, // add sample output data that will be used for testing

 execute: function(input, options, output)
 {
   // will be called every 5 minutes
   // your code here
 },

 activate: function(input, options, output)
 {
   // This function will be called whenever user activates the trigger/workflow. 
  // This function is useful in scenarios where you save cursor to figure out newly added/changed data in the
  // 3rd party services. You can update your cursor so that trigger won't fetch data of the period 
  // during which the trigger was deactivated.
 },

 validate: function(input, options, output)
 {
   // This function will be called when the trigger is created. 
   // This functions validates all inputs provided by the user and sends an error if any of the details (including auth) are incorrect. In case of an error, trigger server won't create the trigger.
 }

}

Actions

Actions define the tasks to be performed. You can add your custom code in this structure to build your own actions.

The following is the basic structure for creating an action.

module.exports =
{
 title: "sample_action",
 description: "",
 version: "v1",
 

 input:
 {
   title: 'sample_action',
   type: 'object',
   properties: {}
 },

 output:
 {
   title: 'output',
   type: 'object',
   properties: {}
 },

 execute: function(input, output)
 {
   // your code here
 }

}

Lookups

Lookup helps you autofill fields with the data from your account. It retrieves a list of records that are associated with the specified property or account. It is important to define the lookup function in the action source code when creating the individual scaffolding.

The following is the basic structure for creating lookup. You can add your custom code in this structure to create your own lookups.
Note: Any type field is not supported in the input schema for the lookup modules.
module.exports =
{
   'name':'sample_lookup',  
   'label': 'label',
   'search': 'false',
   

   'execute': function (input, options, output)
   {
     // your code goes here
   }

}