Contact Methods API Reference
Complete API reference for the Contact Method resource in the beeps SDK.
Contact Method Methods
Section titled “Contact Method Methods”client.contactMethod.create(input)
Section titled “client.contactMethod.create(input)”Create a new contact method for a user.
Parameters:
input: CreateContactMethodInput
Returns: Promise<ContactMethod>
Example:
const method = await client.contactMethod.create({ userId: "usr_alice", transport: "email", value: "alice@example.com",});client.contactMethod.list(params)
Section titled “client.contactMethod.list(params)”List all contact methods for a user.
Parameters:
params: ListContactMethodsParams
Returns: Promise<ContactMethod[]>
Example:
const methods = await client.contactMethod.list({ userId: "usr_alice",});client.contactMethod.delete(id, params)
Section titled “client.contactMethod.delete(id, params)”Delete a contact method.
Parameters:
id: string- Contact method IDparams: DeleteContactMethodParams
Returns: Promise<{ success: boolean }>
Example:
await client.contactMethod.delete("cm_abc123", { userId: "usr_alice",});Safe Methods
Section titled “Safe Methods”All methods have corresponding *Safe variants that return Result<T> instead of throwing:
client.contactMethod.createSafe(input)
Section titled “client.contactMethod.createSafe(input)”Returns: Promise<Result<ContactMethod>>
Example:
const result = await client.contactMethod.createSafe({ userId: "usr_alice", transport: "email", value: "alice@example.com",});
if (result.error) { console.error(result.error.message);} else { console.log(result.data.id);}client.contactMethod.listSafe(params)
Section titled “client.contactMethod.listSafe(params)”Returns: Promise<Result<ContactMethod[]>>
client.contactMethod.deleteSafe(id, params)
Section titled “client.contactMethod.deleteSafe(id, params)”Returns: Promise<Result<{ success: boolean }>>
ContactMethodTransport
Section titled “ContactMethodTransport”type ContactMethodTransport = "email" | "sms";CreateContactMethodInput
Section titled “CreateContactMethodInput”type CreateContactMethodInput = { userId: string; transport: ContactMethodTransport; value: string;};ContactMethod
Section titled “ContactMethod”type ContactMethod = { id: string; userId: string; transport: string; value: string; verified: boolean; createdAt: string; updatedAt: string; deletedAt: string | null;};ListContactMethodsParams
Section titled “ListContactMethodsParams”type ListContactMethodsParams = { userId: string;};DeleteContactMethodParams
Section titled “DeleteContactMethodParams”type DeleteContactMethodParams = { userId: string;};HTTP Endpoints
Section titled “HTTP Endpoints”Create Contact Method
Section titled “Create Contact Method”POST /v0/contact-methodsRequest Body:
{ "userId": "usr_alice", "transport": "email", "value": "alice@example.com"}List Contact Methods
Section titled “List Contact Methods”GET /v0/contact-methods?userId=usr_aliceQuery Parameters:
userId(required): User ID to list contact methods for
Delete Contact Method
Section titled “Delete Contact Method”DELETE /v0/contact-methods/:id?userId=usr_aliceQuery Parameters:
userId(required): User ID (for authorization)
Authentication
Section titled “Authentication”All API requests require authentication using your API key:
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.beeps.dev/v0/contact-methods?userId=usr_alice