Subscribe Trigger (Advanced Trigger)

Last Updated: 17/4/2024     Tags: trigger, triggers, advanced, js, javascript
  • Switch Version
  • V5
  • V4

This example can be used to send welcome emails upon subscriber update, form submission, or import.

When configured for this purpose, a trigger must be set to use the event configured for the update method: for a form, this will generally be an sb event (unless overridden in the form itself).

st=>start: Event e=>end: End op1=>operation: Send Trigger st(right)->op1(right)->e

JS Code

The following code will send a specific activity upon submission of a form:

var tm = require('tm'),
    activityId = 1234;  // Replace with the welcome email activity ID

exports.handler = function (event) {
    tm.send(activityId, event.subscriber.id);
}

Reference

For more information about advanced triggers, see the Advanced Trigger Reference.