Skip to content

Contacts

Create, list, and look up contacts with @wazapin/sdk.

Store customer phone numbers, sync profiles from WhatsApp, and look up who is messaging you — all through wazapin.contacts.

List contacts

const { data } = await wazapin.contacts.list({ limit: 20 });

For automatic pagination:

for await (const contact of wazapin.contacts.listPaginated({ limit: 50 })) {
  console.log(contact.id);
}

Create a contact

const { data: contact } = await wazapin.contacts.create({
  phone_number: "6281234567890",
  name: "Ujang",
});

console.log(contact.id);

Get a contact

const byId = await wazapin.contacts.get("contact_123");
const byPhone = await wazapin.contacts.getByPhone("6281234567890");

Lookup a WhatsApp profile

const profile = await wazapin.contacts.lookup({
  channel_id: "wzp_ch_123",
  phone: "6281234567890",
});

lookup() returns profile information for the channel lookup response. It is not the same shape as a stored contact record.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close