Skip to content

Contact Methods Overview

Contact methods define how users receive notifications. Each user can have multiple email and SMS contact methods. When a relay rule notifies an on-call user, it uses their configured contact methods.

Send notifications via email:

const emailContact = await client.contactMethod.create({
userId: "usr_alice",
transport: "email",
value: "alice@example.com",
});

Send notifications via text message:

const smsContact = await client.contactMethod.create({
userId: "usr_alice",
transport: "sms",
value: "+14155551234", // E.164 format recommended
});

Contact methods have a verified status:

  • Verified: Confirmed to be working and deliverable
  • Unverified: Not yet confirmed

Unverified contact methods receive notifications, but delivery is not guaranteed. Verify methods for reliable delivery.

Users can have multiple ways to be reached:

await client.contactMethod.create({
userId: "usr_alice",
transport: "email",
value: "alice.work@example.com",
});
await client.contactMethod.create({
userId: "usr_alice",
transport: "email",
value: "alice.personal@example.com",
});
await client.contactMethod.create({
userId: "usr_alice",
transport: "sms",
value: "+14155551234",
});

List and manage contact methods:

const methods = await client.contactMethod.list({
userId: "usr_alice",
});
console.log(`Alice has ${methods.length} contact methods`);
const emailMethods = methods.filter((m) => m.transport === "email");
const smsMethods = methods.filter((m) => m.transport === "sms");
console.log(`Emails: ${emailMethods.length}, SMS: ${smsMethods.length}`);

Remove outdated contact information:

const methods = await client.contactMethod.list({
userId: "usr_alice",
});
const oldEmail = methods.find(
(m) => m.value === "old-email@example.com"
);
if (oldEmail) {
await client.contactMethod.delete(oldEmail.id, {
userId: "usr_alice",
});
}

See Best Practices - Contact Methods for configuration guidelines.