Send an event
API referenceCLI reference
loops events send testEvent --email test@example.com
await fetch("https://app.loops.so/api/v1/events/send", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "test@example.com",
eventName: "testEvent",
}),
});
import { LoopsClient } from "loops";
const loops = new LoopsClient("<your-api-key>");
const response = await loops.sendEvent({
email: "test@example.com",
eventName: "testEvent",
});
use Loops\LoopsClient;
$loops = new LoopsClient("<your-api-key>");
$result = $loops->events->send(
email: 'test@example.com',
event_name: 'testEvent',
);
response = LoopsSdk::Events.send(
email: "test@example.com",
event_name: "testEvent",
)
import requests
response = requests.post(
"https://app.loops.so/api/v1/events/send",
headers={
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
json={
"email": "test@example.com",
"eventName": "testEvent",
}
)
Send an event with event properties
Include data that can be used in your workflow emails triggered by the event. API referenceCLI reference
loops events send testEvent \
--email test@example.com \
--props ./event-props.json
await fetch("https://app.loops.so/api/v1/events/send", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "test@example.com",
eventName: "testEvent",
eventProperties: {
"testProperty": "testValue",
},
}),
});
import { LoopsClient } from "loops";
const loops = new LoopsClient("<your-api-key>");
const response = await loops.sendEvent({
email: "test@example.com",
eventName: "testEvent",
eventProperties: {
"testProperty": "testValue",
},
});
use Loops\LoopsClient;
$loops = new LoopsClient("<your-api-key>");
$result = $loops->events->send(
email: 'test@example.com',
event_name: 'testEvent',
event_properties: [
'testProperty' => 'testValue',
],
);
response = LoopsSdk::Events.send(
email: "test@example.com",
event_name: "testEvent",
event_properties: {
testProperty: "testValue",
},
)
import requests
response = requests.post(
"https://app.loops.so/api/v1/events/send",
headers={
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
json={
"email": "test@example.com",
"eventName": "testEvent",
"eventProperties": {
"testProperty": "testValue",
},
}
)
Send an event and update the contact
Include contact properties to update the contact as the event is sent. API referenceCLI reference
loops events send testEvent \
--email test@example.com \
--contact-props ./contact-props.json
await fetch("https://app.loops.so/api/v1/events/send", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "test@example.com",
eventName: "testEvent",
planName: "Pro", // Contact property
}),
});
import { LoopsClient } from "loops";
const loops = new LoopsClient("<your-api-key>");
const response = await loops.sendEvent({
email: "test@example.com",
eventName: "testEvent",
contactProperties: {
planName: "Pro",
},
});
use Loops\LoopsClient;
$loops = new LoopsClient("<your-api-key>");
$result = $loops->events->send(
email: 'test@example.com',
event_name: 'testEvent',
contact_properties: [
'planName' => 'Pro',
],
);
response = LoopsSdk::Events.send(
email: "test@example.com",
event_name: "testEvent",
contact_properties: {
planName: "Pro",
},
)
import requests
response = requests.post(
"https://app.loops.so/api/v1/events/send",
headers={
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
json={
"email": "test@example.com",
"eventName": "testEvent",
"contactProperties": {
"planName": "Pro",
},
}
)
Send an event and subscribe to mailing lists
Include amailingLists object to add the contact to one or more mailing lists. If the contact does not exist yet, it will be created and subscribed to the specified lists in the same request.
API referenceCLI reference
loops events send testEvent \
--email test@example.com \
--list cm06f5v0e45nf0ml5754o9cix=true
await fetch("https://app.loops.so/api/v1/events/send", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
body: JSON.stringify({
email: "test@example.com",
eventName: "testEvent",
mailingLists: {
"cm06f5v0e45nf0ml5754o9cix": true,
},
}),
});
import { LoopsClient } from "loops";
const loops = new LoopsClient("<your-api-key>");
const response = await loops.sendEvent({
email: "test@example.com",
eventName: "testEvent",
mailingLists: {
"cm06f5v0e45nf0ml5754o9cix": true,
},
});
use Loops\LoopsClient;
$loops = new LoopsClient("<your-api-key>");
$result = $loops->events->send(
email: 'test@example.com',
event_name: 'testEvent',
mailing_lists: [
'cm06f5v0e45nf0ml5754o9cix' => true,
],
);
response = LoopsSdk::Events.send(
email: "test@example.com",
event_name: "testEvent",
mailing_lists: {
"cm06f5v0e45nf0ml5754o9cix": true,
},
)
import requests
response = requests.post(
"https://app.loops.so/api/v1/events/send",
headers={
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
},
json={
"email": "test@example.com",
"eventName": "testEvent",
"mailingLists": {
"cm06f5v0e45nf0ml5754o9cix": True,
},
}
)
Send an event with an idempotency key
Add anIdempotency-Key header to the request to prevent duplicate requests.
API referenceCLI reference
loops events send testEvent \
--email test@example.com \
--idempotency-key 550e8400-e29b-41d4-a716-446655440000
await fetch("https://app.loops.so/api/v1/events/send", {
method: "POST",
headers: {
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
"Idempotency-Key": "550e8400-e29b-41d4-a716-446655440000",
},
body: JSON.stringify({
email: "test@example.com",
eventName: "testEvent",
}),
});
import { LoopsClient } from "loops";
const loops = new LoopsClient("<your-api-key>");
const response = await loops.sendEvent({
email: "test@example.com",
eventName: "testEvent",
headers: {
"Idempotency-Key": "550e8400-e29b-41d4-a716-446655440000",
},
});
use Loops\LoopsClient;
$loops = new LoopsClient("<your-api-key>");
$result = $loops->events->send(
email: 'test@example.com',
event_name: 'testEvent',
headers: [
'Idempotency-Key' => '550e8400-e29b-41d4-a716-446655440000',
],
);
response = LoopsSdk::Events.send(
email: "test@example.com",
event_name: "testEvent",
headers: {
"Idempotency-Key" => "550e8400-e29b-41d4-a716-446655440000",
},
)
import requests
response = requests.post(
"https://app.loops.so/api/v1/events/send",
headers={
"Authorization": "Bearer <your-api-key>",
"Content-Type": "application/json"
"Idempotency-Key": "550e8400-e29b-41d4-a716-446655440000",
},
json={
"email": "test@example.com",
"eventName": "testEvent",
}
)

