Messente logo

Phonebook API

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

Blacklist

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.

Returns all blacklisted phone numbers

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

Successful Response

HTTP 200
{
  "phoneNumbers": [
    "+37251000000",
    "+37251000001"
  ]
}
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)
const MessenteApi = require('messente_api');
const defaultClient = MessenteApi.ApiClient.instance;

const basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_MESSENTE_API_USERNAME';
basicAuth.password = 'YOUR_MESSENTE_API_PASSWORD';

const api = new MessenteApi.BlacklistApi();

api.fetchBlacklist((error, data, response) => {
  if (error) {
    console.error(error.response.body);
  } else {
    console.log('API called successfully. \n', response.body);
  }
});
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Messente\Api\Configuration;
use Messente\Api\Api\BlacklistApi;
use GuzzleHttp\Client;

$config = Configuration::getDefaultConfiguration();
$config->setUsername('YOUR_MESSENTE_API_USERNAME');
$config->setPassword('YOUR_MESSENTE_API_PASSWORD');

$api = new BlacklistApi(new Client(), $config);

try {
  $response = $api->fetchBlacklist();
  echo $response . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling fetchBlacklist: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.BlacklistApi;
import com.messente.api.FetchBlacklistSuccess;
import com.messente.auth.HttpBasicAuth;

public class FetchBlacklistExample {

    public static void main(String[] args) {
        ApiClient apiClient = new ApiClient();

        HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");
        basicAuth.setUsername("YOUR_MESSENTE_API_USERNAME");
        basicAuth.setPassword("YOUR_MESSENTE_API_PASSWORD");

        BlacklistApi api = new BlacklistApi(apiClient);

        try {
            FetchBlacklistSuccess response = api.fetchBlacklist();
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling fetchBlacklist");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

MessenteApi.configure do |config|
  config.username = 'YOUR_MESSENTE_API_USERNAME'
  config.password = 'YOUR_MESSENTE_API_PASSWORD'
end

api = MessenteApi::BlacklistApi.new

begin
  result = api.fetch_blacklist
  p result.phone_numbers
rescue MessenteApi::ApiError => e
  p "Exception when calling fetch_blacklist: #{e.response_body}"
end
using System;
using com.Messente.Api.Api;
using com.Messente.Api.Client;
using com.Messente.Api.Model;

namespace Example
{
    class FetchBlacklistExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            var api = new BlacklistApi();

            try
            {
                FetchBlacklistSuccess result = api.FetchBlacklist();
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling FetchBlacklist: " + e.Message);
            }
        }
    }
}
curl https://api.messente.com/v1/phonebook/blacklist \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD

Adds a phone number to the blacklist

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

Request Body

{
  "phoneNumber": "+37251000000"
}

Successful Response

HTTP 204
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.add_to_blacklist({"phoneNumber": "+37251000000"})
    print("API called successfully.")
except ApiException as e:
    print("Exception when calling add_to_blacklist: %s\n" % e)
const MessenteApi = require('messente_api');
const defaultClient = MessenteApi.ApiClient.instance;

const basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_MESSENTE_API_USERNAME';
basicAuth.password = 'YOUR_MESSENTE_API_PASSWORD';

const api = new MessenteApi.BlacklistApi();

api.addToBlacklist(
  { phoneNumber: '+37251000000' },
  (error, data, response) => {
    if (error) {
      console.error(error.response.body);
    } else {
      console.log('API called successfully.');
    }
  }
);
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Messente\Api\Configuration;
use Messente\Api\Api\BlacklistApi;
use GuzzleHttp\Client;

$config = Configuration::getDefaultConfiguration();
$config->setUsername('YOUR_MESSENTE_API_USERNAME');
$config->setPassword('YOUR_MESSENTE_API_PASSWORD');

$api = new BlacklistApi(new Client(), $config);

try {
  $api->addToBlacklist([
    'phoneNumber' => '+37251000000'
  ]);
  echo 'API called successfully.' . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling addToBlacklist: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.BlacklistApi;
import com.messente.api.NumberToBlacklist;
import com.messente.auth.HttpBasicAuth;

public class AddToBlacklistExample {
    public static void main(String[] args) {
        ApiClient apiClient = new ApiClient();

        HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");
        basicAuth.setUsername("YOUR_MESSENTE_API_USERNAME");
        basicAuth.setPassword("YOUR_MESSENTE_API_PASSWORD");

        BlacklistApi api = new BlacklistApi(apiClient);

        try {
            api.addToBlacklist(new NumberToBlacklist().phoneNumber("+3725100000"));
            System.out.println("API called successfully.");
        } catch (ApiException e) {
            System.err.println("Exception when calling addToBlacklist");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

MessenteApi.configure do |config|
  config.username = 'YOUR_MESSENTE_API_USERNAME'
  config.password = 'YOUR_MESSENTE_API_PASSWORD'
end

api = MessenteApi::BlacklistApi.new
phone_number = MessenteApi::NumberToBlacklist.new(
  phone_number: '+37251000000'
)

begin
  api.add_to_blacklist(phone_number)
  p 'API called successfully.'
rescue MessenteApi::ApiError => e
  p "Exception when calling add_to_blacklist: #{e.response_body}"
end
using System;
using com.Messente.Api.Api;
using com.Messente.Api.Model;
using com.Messente.Api.Client;

namespace Example
{
    public class AddToBlacklistExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            BlacklistApi api = new BlacklistApi();

            try
            {
                api.AddToBlacklist(new NumberToBlacklist("+37251000000"));
                Console.WriteLine("API called successfully.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling AddToBlacklist: " + e.Message);
            }
        }
    }
}
curl -X POST \
  https://api.messente.com/v1/phonebook/blacklist \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD \
  -H 'Content-Type: application/json' \
  -d '{
  "phoneNumber": "+37251000000"
}'

Checks if a phone number is blacklisted

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

Parameters

phone=%2B37251000000

Successful Response

HTTP 204
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)
const MessenteApi = require('messente_api');
const defaultClient = MessenteApi.ApiClient.instance;

const basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_MESSENTE_API_USERNAME';
basicAuth.password = 'YOUR_MESSENTE_API_PASSWORD';

const api = new MessenteApi.BlacklistApi();

api.isBlacklisted('+37251000000', (error, data, response) => {
  if (error) {
    console.error(error.response.body);
  } else {
    console.log('API called successfully.');
  }
});
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Messente\Api\Configuration;
use Messente\Api\Api\BlacklistApi;
use GuzzleHttp\Client;

$config = Configuration::getDefaultConfiguration();
$config->setUsername('YOUR_MESSENTE_API_USERNAME');
$config->setPassword('YOUR_MESSENTE_API_PASSWORD');

$api = new BlacklistApi(new Client(), $config);

try {
  $api->isBlacklisted('+37251000000');
  echo 'API called successfully.' . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling isBlacklisted: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.BlacklistApi;
import com.messente.auth.HttpBasicAuth;

public class IsBlacklistedExample {
    public static void main(String[] args) {
        ApiClient apiClient = new ApiClient();

        HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");
        basicAuth.setUsername("YOUR_MESSENTE_API_USERNAME");
        basicAuth.setPassword("YOUR_MESSENTE_API_PASSWORD");

        BlacklistApi api = new BlacklistApi(apiClient);

        try {
            api.isBlacklisted("+37251000000");
            System.out.println("API called successfully.");
        } catch (ApiException e) {
            System.err.println("Exception when calling isBlacklisted");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

MessenteApi.configure do |config|
  config.username = 'YOUR_MESSENTE_API_USERNAME'
  config.password = 'YOUR_MESSENTE_API_PASSWORD'
end

api = MessenteApi::BlacklistApi.new

begin
  api.is_blacklisted('+37251000000')
  p 'API called successfully.'
rescue MessenteApi::ApiError => e
  p "Exception when calling is_blacklisted: #{e.response_body}"
end
using System;
using com.Messente.Api.Api;
using com.Messente.Api.Client;

namespace Example
{
    public class IsBlacklistedExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            var api = new BlacklistApi();

            try
            {
                api.IsBlacklisted("+37251000000");
                Console.WriteLine("API called successfully.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling IsBlacklisted: " + e.Message);
            }
        }
    }
}
curl https://api.messente.com/v1/phonebook/blacklist/+37251000000 \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD

Deletes a phone number from the blacklist

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

Parameters

phone=%2B37251000000

Successful Response

HTTP 204
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)
const MessenteApi = require('messente_api');
const defaultClient = MessenteApi.ApiClient.instance;

const basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_MESSENTE_API_USERNAME';
basicAuth.password = 'YOUR_MESSENTE_API_PASSWORD';

const api = new MessenteApi.BlacklistApi();

api.deleteFromBlacklist('+37251000000', (error, data, response) => {
  if (error) {
    console.error(error.response.body);
  } else {
    console.log('API called successfully.');
  }
});
<?php
require_once __DIR__ . '/vendor/autoload.php';
use GuzzleHttp\Client;
use Messente\Api\Configuration;
use Messente\Api\Api\BlacklistApi;

$config = Configuration::getDefaultConfiguration();
$config->setUsername('YOUR_MESSENTE_API_USERNAME');
$config->setPassword('YOUR_MESSENTE_API_PASSWORD');

$api = new BlacklistApi(new Client(), $config);

try {
  $api -> deleteFromBlacklist('+37251000000');
  echo 'API called successfully.' . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling deleteFromBlacklist: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.BlacklistApi;
import com.messente.auth.HttpBasicAuth;

public class DeleteFromBlacklistExample {
    public static void main(String[] args) {
        ApiClient apiClient = new ApiClient();

        HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");
        basicAuth.setUsername("YOUR_MESSENTE_API_USERNAME");
        basicAuth.setPassword("YOUR_MESSENTE_API_PASSWORD");

        BlacklistApi api = new BlacklistApi(apiClient);

        try {
            api.deleteFromBlacklist("+37251000000");
            System.out.println("API called successfully.");
        } catch (ApiException e) {
            System.err.println("Exception when calling deleteFromBlacklist");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

MessenteApi.configure do |config|
  config.username = 'YOUR_MESSENTE_API_USERNAME'
  config.password = 'YOUR_MESSENTE_API_PASSWORD'
end

api = MessenteApi::BlacklistApi.new

begin
  api.delete_from_blacklist('+37251000000')
  p 'API called successfully.'
rescue MessenteApi::ApiError => e
  p "Exception when calling delete_from_blacklist: #{e.response_body}"
end
using System;
using com.Messente.Api.Api;
using com.Messente.Api.Client;

namespace Example
{
    public class DeleteFromBlacklistExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            var api = new BlacklistApi();

            try
            {
                api.DeleteFromBlacklist("+37251000000");
                Console.WriteLine("API called successfully.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling DeleteFromBlacklist: " + e.Message);
            }
        }
    }
}
curl -X DELETE https://api.messente.com/v1/phonebook/blacklist/+37251000000 \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD