Skip to main content

Blacklist

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


Overview

Blacklist is a list of numbers that is tied to one specific account. All messages sent using any API credentials from this account, are passed through this list. If the number is in the list, the message is not sent. It applies both to API calls and messages sent from the Dashboard.

Return all blacklisted phone numbers

Endpoint

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

Successful Response

HTTP 200

{
"phoneNumbers": [
"+37251000000",
"+37251000001"
]
}

Using a library

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

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

api = BlacklistApi(ApiClient(configuration))

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

Add a phone number to the blacklist

Endpoint

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

Request Body

{
"phoneNumber": "+37251000000"
}

Successful Response

HTTP 204

Using a library

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

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

api = BlacklistApi(ApiClient(configuration))

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

Check if a phone number is blacklisted

Endpoint

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

Parameters

phone=%2B37251000000

Successful Response

HTTP 204

Using a library

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

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

api = BlacklistApi(ApiClient(configuration))

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

Delete a phone number from the blacklist

Endpoint

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

Parameters

phone=%2B37251000000

Successful Response

HTTP 204

Using a library

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

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

api = BlacklistApi(ApiClient(configuration))

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