Create Contacts
Before you're able to track the Contact analytics, you first have to create a Contact.
A contact can be an entity of your choice, meaning it can be a user, team, project, client etc.
Creating a contact
To create a contact, you have two options:
- Use the API directly: You can create a Contact with the cURL code snippet.
- SDK Implementation: (Recommended) The SDK provides a more streamlined approach to creating Contacts.
curl --location 'https://my.orq.ai/v2/contacts' \
--header 'Authorization: Bearer <your-api-key>:' \
--header 'Content-Type: application/json' \
--data-raw '{
"external_id": "1234",
"display_name": "Client A",
"email": "[email protected]",
"avatar_url": "https://gravatar.com/avatar/6c568aaa96fdbd3e466b500e6eb312dc?s=400&d=robohash&r=x",
"metadata": {
"role": "admin"
}
}'
try {
const contact = client.contacts.create({
external_id: 'user123',
display_name: 'John Doe',
email: '[email protected]',
metadata: { role: 'admin', department: 'IT' },
avatar_url: 'https://example.com/avatar.jpg',
});
} catch (e) {
console.error(e);
}
contact = client.contacts.create(
external_id="user123",
display_name="John Doe",
email="[email protected]",
avatar_url="https://example.com/avatar.jpg",
metadata={"role": "admin"}
)
Developers, please see the API Reference for further explanation.
Updated 2 months ago