Skip to content

Automation events

An automation event is a custom event you create in Go-Mailer and trigger from your own applications to start your automations.

  • POST /automations

Trigger an event

You need two pieces of information: the code of the event to trigger, and a context object with the relevant details about the event.

POSThttps://api.go-mailer.com/v1/automations

Request body

Trigger event request body
ParameterTypeRequiredDescription
event_codestringRequired

The unique code that identifies the event. No two events should share a code.

contact_emailstringRequired

The email address of the user the event was triggered for. It identifies the user.

contextobjectOptional

key => value pairs with extra information about the event and the person it was triggered for, including the contact's details.

Sample request

POST /v1/automations
const response = await fetch("https://api.go-mailer.com/v1/automations", {
  method: "POST",
  headers: {
    Authorization: "Bearer <API_KEY>"
  },
  body: JSON.stringify({
    event_code: "makes_purchase",
    contact_email: "johndoe@example.com",
    context: {
      firstname: "John",
      lastname: "Doe",
      item: "iPhone",
      price: 1999.99
    }
  })
});