curl -X POST https://api.magpipe.ai/functions/v1/create-contact \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+14155551234",
"name": "John Smith",
"email": "john@example.com",
"company": "Acme Corp",
"tags": ["customer", "vip"]
}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/create-contact',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
phone_number: '+14155551234',
name: 'John Smith',
email: 'john@example.com',
company: 'Acme Corp',
tags: ['customer', 'vip']
}),
}
);
const contact = await response.json();
console.log('Created:', contact.id);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/create-contact',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'phone_number': '+14155551234',
'name': 'John Smith',
'email': 'john@example.com',
'company': 'Acme Corp',
'tags': ['customer', 'vip']
}
)
contact = response.json()
print(f"Created: {contact['id']}")
{
"id": "c1d2e3f4-5678-9abc-def0-123456789abc",
"phone_number": "+14155551234",
"name": "John Smith",
"email": "john@example.com",
"company": "Acme Corp",
"notes": null,
"tags": ["customer", "vip"],
"metadata": {},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "duplicate_contact",
"message": "A contact with this phone number already exists"
}
}
Contacts
Create Contact
Create a new contact in your address book
POST
/
create-contact
curl -X POST https://api.magpipe.ai/functions/v1/create-contact \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+14155551234",
"name": "John Smith",
"email": "john@example.com",
"company": "Acme Corp",
"tags": ["customer", "vip"]
}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/create-contact',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
phone_number: '+14155551234',
name: 'John Smith',
email: 'john@example.com',
company: 'Acme Corp',
tags: ['customer', 'vip']
}),
}
);
const contact = await response.json();
console.log('Created:', contact.id);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/create-contact',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'phone_number': '+14155551234',
'name': 'John Smith',
'email': 'john@example.com',
'company': 'Acme Corp',
'tags': ['customer', 'vip']
}
)
contact = response.json()
print(f"Created: {contact['id']}")
{
"id": "c1d2e3f4-5678-9abc-def0-123456789abc",
"phone_number": "+14155551234",
"name": "John Smith",
"email": "john@example.com",
"company": "Acme Corp",
"notes": null,
"tags": ["customer", "vip"],
"metadata": {},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "duplicate_contact",
"message": "A contact with this phone number already exists"
}
}
Create a new contact for managing caller information and conversation history.
Request Body
Response
Returns the created contact object.curl -X POST https://api.magpipe.ai/functions/v1/create-contact \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+14155551234",
"name": "John Smith",
"email": "john@example.com",
"company": "Acme Corp",
"tags": ["customer", "vip"]
}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/create-contact',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
phone_number: '+14155551234',
name: 'John Smith',
email: 'john@example.com',
company: 'Acme Corp',
tags: ['customer', 'vip']
}),
}
);
const contact = await response.json();
console.log('Created:', contact.id);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/create-contact',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={
'phone_number': '+14155551234',
'name': 'John Smith',
'email': 'john@example.com',
'company': 'Acme Corp',
'tags': ['customer', 'vip']
}
)
contact = response.json()
print(f"Created: {contact['id']}")
{
"id": "c1d2e3f4-5678-9abc-def0-123456789abc",
"phone_number": "+14155551234",
"name": "John Smith",
"email": "john@example.com",
"company": "Acme Corp",
"notes": null,
"tags": ["customer", "vip"],
"metadata": {},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
{
"error": {
"code": "duplicate_contact",
"message": "A contact with this phone number already exists"
}
}