Skip to main content

Create Contact

Voilà! You are about to create your first contact on Notify Africa.

What is a Contact?

A contact is a unique identifier that represents a recipient of an SMS message. It is a great way to store and manage your contacts and send personalized messages to your customers and stakeholders.

Contacts can be individuals, groups, or organizations that you want to communicate with using SMS messages.

try {
// Send a POST request to the API endpoint for creating contacts
const baseUrl = 'https://example.com/v2'; // contact us for the base URL
const token = 'YOUR_API_TOKEN';
const endPoint = '/contacts/create';
const url = `${baseUrl}${endPoint}`;

const response = await fetch(url, {
method: 'POST',
body: JSON.stringify({
contacts: [{
names: 'John Doe',
number: '255xxxxxxx',
email: 'john@doe.com'
}]
}),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${token}`
}
});

// Parse the response body as JSON
const json = await response.json();
console.log('Response:', json);
} catch (error) {
console.error('Error:', error);
}

Please note that you'll need to replace the placeholder values in the requestBody and "Bearer YOUR_API_TOKEN" with the actual values for the contact you want to add and your Account API token, respectively.