This is an object which represents a custom automation event on Go-Mailer. These events can be created by you and they can be triggered from your applications.
As stated in the introduction, you can trigger events from your own application.
You generally need two key blocs of information: the code of the event to be triggered and a context object containing relevant information about the event.
The is a unique code that is used to identify a specific Event. Two events SHOULD NOT have the same code.
This is a set of Key => value pairs which is expected to contain extra information related to the event and target for whom the event was triggered. This includes the contact's information.
The user's email address. This is required and is used to identify the user for whom the event was triggered.
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
}
})
});