Automations
Automations SDK
createAutomation

createAutomation

Create an automation for an account using one of the existing triggers.

Usage

const automation = await automationClient.createAutomation({
  type: 'time-based',
  data: {
    trigger: {
      triggerData: {
        cronExpression: '*/60 * * * * *',
        startDate: new Date().getTime(),
      },
    },
    actions: [
      {
        type: 'static',
        target: '0x503b54Ed1E62365F0c9e4caF1479623b08acbe77',
        value: 100,
        callData: '0x',
      },
    ],
    maxNumberOfExecutions: 10,
  },
})

Parameters

trigger

The trigger data for the relevant trigger type.

actions

Array of actions to be executed when the automation is triggered.

maxNumberOfExecutions

  • Type: number

Maximum number of executions for the automation.

Returns

id

  • Type: string

Id of the created automation.

hash

Hash of the created automation to be signed by account owner to activate the automation.