cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code Actions: Trigger event

Code Actions: Trigger event

Within Code actions you can trigger events just like you would using the UI.

async payload => {
  trigger('EVENT_NAME')
}

This allows you to move static content away from your code and trigger flows based on more complex business rules or logic.

async payload => {
  toolbelt.takeover()

  if(await toolbelt.isBusinessHours({ label: "livechat" })) {
    trigger('TAKEOVER_OFFICE_HOURS')
  } else{
    trigger('TAKEOVER_OUT_OF_OFFICE')
  }
}

The example above is a piece of Cloud Code that will trigger 2 different flows depending on the current time.

Labels (1)

Code Actions: Trigger event

Within Code actions you can trigger events just like you would using the UI.

async payload => {
  trigger('EVENT_NAME')
}

This allows you to move static content away from your code and trigger flows based on more complex business rules or logic.

async payload => {
  toolbelt.takeover()

  if(await toolbelt.isBusinessHours({ label: "livechat" })) {
    trigger('TAKEOVER_OFFICE_HOURS')
  } else{
    trigger('TAKEOVER_OUT_OF_OFFICE')
  }
}

The example above is a piece of Cloud Code that will trigger 2 different flows depending on the current time.

Labels (1)

Code Actions: Trigger event

Within Code actions you can trigger events just like you would using the UI.

async payload => {
  trigger('EVENT_NAME')
}

This allows you to move static content away from your code and trigger flows based on more complex business rules or logic.

async payload => {
  toolbelt.takeover()

  if(await toolbelt.isBusinessHours({ label: "livechat" })) {
    trigger('TAKEOVER_OFFICE_HOURS')
  } else{
    trigger('TAKEOVER_OUT_OF_OFFICE')
  }
}

The example above is a piece of Cloud Code that will trigger 2 different flows depending on the current time.

Labels (1)
Version history
Last update:
‎06-17-2021 05:24 AM
Updated by:
Contributors