Skip to main content

Edit Contact

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

After all sometimes you need to update your contacts information.

Let's get started! 🚀

const id = 3
const baseUrl = 'https://example.com/v2'; // contact us for the base URL
const url = `${baseUrl}/contacts/update/${id}`;

const response = await fetch(url, {
method: 'PUT',
body: JSON.stringify({
names: 'Joseph',
number: '255778xxxx',
email: 'test@mail.com'
}),
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': `Bearer ${token}`
},
});

Here's a breakdown of the code inside the function:

  • id: The unique identifier of the contact you want to update.
  • baseUrl: The base URL of the Notify Africa API.
  • endPoint: The endpoint for updating a contact.
  • method: The HTTP method used for the request (PUT).
  • body: The data sent in the request body (contact information).
  • credentials: The credentials mode used for the request (include).
  • token: The API token used to authenticate the request.