Skip to main content

Contacts

Phonebook API enables you to use our blacklisting feature and manage contacts and groups


Overview​

Every contact in the Phonebook may belong to one or many Groups, which makes it easy to send targeted messages just by selecting the Groups you want.

You can think of Groups also as Labels that each Contacts can have.

When sending message to multiple groups, Messente only sends one message per Contact. This means you can send messages without having to worry about duplicate messages being sent.

Using the Phonebook API you can:

  • Select Contacts and filter by Groups
  • Retrieve Contact details
  • Create a new Contact
  • Update an existing Contacts
  • Add or remove a Contact from a Group
  • Delete a Contact
info

Bear in mind, that when deleting a Contact, it will be lost and cannot be restored.

Retrieve a contact​

Endpoint​

GET https://api.messente.com/v1/phonebook/contacts/{phone}

Parameters​

phone=%2B37251000000

Successful Response​

HTTP 200

{
"contact": {
"phoneNumber": "+37251000000",
"email": "anyone@messente.com",
"firstName": "Any",
"lastName": "One",
"company": "Messente",
"title": "Sir",
"custom": "Any custom",
"custom2": "Any custom two",
"custom3": "Any custom three",
"custom4": "Any custom four",
"scheduledDeletionDate": "2020-08-31"
}
}

Using a library​

from messente_api import ContactsApi, ApiClient, Configuration
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api = ContactsApi(ApiClient(configuration))

try:
response = api.fetch_contact("+37251000000")
print(response)
except ApiException as e:
print("Exception when calling fetch_contact: %s\n" % e)

Delete a contact​

Endpoint​

DELETE https://api.messente.com/v1/phonebook/contacts/{phone}

Parameters​

phone=%2B37251000000

Successful Response​

HTTP 204

Using a library​

from messente_api import ContactsApi, ApiClient, Configuration
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api = ContactsApi(ApiClient(configuration))

try:
api.delete_contact("+37251000000")
print("API called successfully.")
except ApiException as e:
print("Exception when calling delete_contact: %s\n" % e)

Update a contact​

Endpoint​

PATCH https://api.messente.com/v1/phonebook/contacts/{phone}

Parameters​

phone=%2B37251000000

Request Body​

{
"email": "anyone@messente.com",
"firstName": "Any",
"lastName": "One",
"company": "Messente",
"title": "Sir",
"custom": "Any custom",
"custom2": "Any custom two",
"custom3": "Any custom three",
"custom4": "Any custom four"
}

Successful Response​

HTTP 200

{
"contact": {
"phoneNumber": "+37251000000",
"email": "anyone@messente.com",
"firstName": "Any",
"lastName": "One",
"company": "Messente",
"title": "Sir",
"custom": "Any custom",
"custom2": "Any custom two",
"custom3": "Any custom three",
"custom4": "Any custom four",
"scheduledDeletionDate": "2020-08-31"
}
}

Using a library​

from messente_api import ContactsApi, ApiClient, Configuration
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api = ContactsApi(ApiClient(configuration))

try:
response = api.update_contact(
"+37251000000",
{
"email": "anyone@messente.com",
"firstName": "Any",
"lastName": "One",
"company": "Messente",
"title": "Sir",
"custom": "Any custom",
"custom2": "Any custom two",
"custom3": "Any custom three",
"custom4": "Any custom four",
},
)
print(response)
except ApiException as e:
print("Exception when calling update_contact: %s\n" % e)

List groups of a contact​

Endpoint​

GET https://api.messente.com/v1/phonebook/contacts/{phone}/groups

Parameters​

phone=%2B37251000000

Successful Response​

HTTP 200

{
"groups": [
{
"contactsCount": 1,
"name": "Any group name",
"id": "5792a02a-e5c2-422b-a0a0-0ae65d814663",
"createdOn": "2019-04-22T11:46:23.753613Z"
}
]
}

Using a library​

from messente_api import ContactsApi, ApiClient, Configuration
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api = ContactsApi(ApiClient(configuration))

try:
response = api.fetch_contact_groups("+37251000000")
print(response)
except ApiException as e:
print("Exception when calling fetch_contact_groups: %s\n" % e)

List all contacts​

Endpoint​

GET https://api.messente.com/v1/phonebook/contacts

Parameters​

groupIds=5792a02a-e5c2-422b-a0a0-0ae65d814663&groupIds=4792a02a-e5c2-422b-a0a0-0ae65d814662

Successful Response​

HTTP 200

{
"contacts": [
{
"phoneNumber": "+37251000000",
"email": "anyone@messente.com",
"firstName": "Any",
"lastName": "One",
"company": "Messente",
"title": "Sir",
"custom": "Any custom",
"custom2": "Any custom two",
"custom3": "Any custom three",
"custom4": "Any custom four",
"scheduledDeletionDate": "2020-08-31"
}
]
}

Using a library​

from messente_api import ContactsApi, ApiClient, Configuration
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api = ContactsApi(ApiClient(configuration))

try:
response = api.fetch_contacts(
group_ids=[
"5792a02a-e5c2-422b-a0a0-0ae65d814663",
"4792a02a-e5c2-422b-a0a0-0ae65d814662",
]
)
print(response)
except ApiException as e:
print("Exception when calling fetch_contacts: %s\n" % e)

Create a new contact​

Endpoint​

POST https://api.messente.com/v1/phonebook/contacts

Request Body​

{
"phoneNumber": "+37251000000",
"email": "anyone@messente.com",
"firstName": "Any",
"lastName": "One",
"company": "Messente",
"title": "Sir",
"custom": "Any custom",
"custom2": "Any custom two",
"custom3": "Any custom three",
"custom4": "Any custom four"
}

Successful Response​

HTTP 201

{
"contact": {
"phoneNumber": "+37251000000",
"email": "anyone@messente.com",
"firstName": "Any",
"lastName": "One",
"company": "Messente",
"title": "Sir",
"custom": "Any custom",
"custom2": "Any custom two",
"custom3": "Any custom three",
"custom4": "Any custom four",
"scheduledDeletionDate": "2020-08-31"
}
}

Using a library​

from messente_api import ContactsApi, ApiClient, Configuration
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api = ContactsApi(ApiClient(configuration))

try:
response = api.create_contact(
{
"phoneNumber": "+37251000000",
"email": "anyone@messente.com",
"firstName": "Any",
"lastName": "One",
"company": "Messente",
"title": "Sir",
"custom": "Any custom",
"custom2": "Any custom two",
"custom3": "Any custom three",
"custom4": "Any custom four",
}
)
print(response)
except ApiException as e:
print("Exception when calling create_contact: %s\n" % e)

Add a contact to a group​

Endpoint​

POST https://api.messente.com/v1/phonebook/groups/{groupId}/contacts/{phone}

Parameters​

groupId=5792a02a-e5c2-422b-a0a0-0ae65d814663&phone=%2B37251000000

Successful Response​

HTTP 201

{}

Using a library​

from messente_api import ContactsApi, ApiClient, Configuration
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api = ContactsApi(ApiClient(configuration))

try:
response = api.add_contact_to_group(
"5792a02a-e5c2-422b-a0a0-0ae65d814663", "+37251000000"
)
print(response)
except ApiException as e:
print("Exception when calling add_contact_to_group: %s\n" % e)

Remove a contact from a group​

Endpoint​

DELETE https://api.messente.com/v1/phonebook/groups/{groupId}/contacts/{phone}

Parameters​

groupId=5792a02a-e5c2-422b-a0a0-0ae65d814663&phone=%2B37251000000

Successful Response​

HTTP 204

Using a library​

from messente_api import ContactsApi, ApiClient, Configuration
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api = ContactsApi(ApiClient(configuration))

try:
api.remove_contact_from_group(
"5792a02a-e5c2-422b-a0a0-0ae65d814663", "+37251000000"
)
print("API called successfully.")
except ApiException as e:
print("Exception when calling remove_contact_from_group: %s\n" % e)