Phonebook API

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

Groups

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

  • List all Groups
  • Create a new Group
  • Update an existing Group
  • Delete a Group

Bear in mind, that when deleting a Group, all the Contacts remain in the Phonebook

Lists a group

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

Parameters

groupId=5792a02a-e5c2-422b-a0a0-0ae65d814663

Successful Response

HTTP 200
{
  "group": {
    "contactsCount": 1,
    "name": "Any group name",
    "id": "5792a02a-e5c2-422b-a0a0-0ae65d814663",
    "createdOn": "2019-04-22T11:46:23.753613Z"
  }
}
from messente_api import GroupsApi, ApiClient, Configuration
from messente_api.rest import ApiException

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

api = GroupsApi(ApiClient(configuration))

try:
    response = api.fetch_group("5792a02a-e5c2-422b-a0a0-0ae65d814663")
    print(response)
except ApiException as e:
    print("Exception when calling fetch_group: %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.GroupsApi();

api.fetchGroup(
  '5792a02a-e5c2-422b-a0a0-0ae65d814663',
  (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 GuzzleHttp\Client;
use Messente\Api\Api\GroupsApi;

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

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

try {
  $response = $api->fetchGroup('5792a02a-e5c2-422b-a0a0-0ae65d814663');
  echo $response . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling fetchGroup: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.GroupEnvelope;
import com.messente.api.GroupsApi;
import com.messente.auth.HttpBasicAuth;

public class FetchGroupExample {
    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");

        GroupsApi api = new GroupsApi(apiClient);

        try {
            GroupEnvelope response = api.fetchGroup("5792a02a-e5c2-422b-a0a0-0ae65d814663");
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling fetchGroup");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::GroupsApi.new

begin
  result = api.fetch_group('5792a02a-e5c2-422b-a0a0-0ae65d814663')
  p result.group
rescue MessenteApi::ApiError => e
  p "Exception when calling fetch_group: #{e.response_body}"
end
using System;
using com.Messente.Api.Api;
using com.Messente.Api.Client;
using com.Messente.Api.Model;

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

            var api = new GroupsApi();

            try
            {
                GroupEnvelope result = api.FetchGroup(
                    "5792a02a-e5c2-422b-a0a0-0ae65d814663"
                    );
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling FetchGroups: " + e.Message);
            }
        }
    }
}
curl https://api.messente.com/v1/phonebook/groups/5792a02a-e5c2-422b-a0a0-0ae65d814663 \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD

Deletes a group

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

Parameters

groupId=5792a02a-e5c2-422b-a0a0-0ae65d814663

Successful Response

HTTP 204
from messente_api import GroupsApi, ApiClient, Configuration
from messente_api.rest import ApiException

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

api = GroupsApi(ApiClient(configuration))

try:
    api.delete_group("5792a02a-e5c2-422b-a0a0-0ae65d814663")
    print("API called successfully.")
except ApiException as e:
    print("Exception when calling delete_group: %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.GroupsApi();

api.deleteGroup(
  '5792a02a-e5c2-422b-a0a0-0ae65d814663',
  (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\GroupsApi;

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

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

try {
  $api->deleteGroup('5792a02a-e5c2-422b-a0a0-0ae65d814663');
  echo 'API called successfully.' . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling deleteGroup: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.GroupsApi;
import com.messente.auth.HttpBasicAuth;

public class DeleteGroupExample {
    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");

        GroupsApi api = new GroupsApi(apiClient);

        try {
            api.deleteGroup("5792a02a-e5c2-422b-a0a0-0ae65d814663");
            System.out.println("API called successfully.");
        } catch (ApiException e) {
            System.err.println("Exception when calling deleteGroup");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::GroupsApi.new

begin
  api.delete_group('5792a02a-e5c2-422b-a0a0-0ae65d814663')
  p 'API called successfully.'
rescue MessenteApi::ApiError => e
  p "Exception when calling delete_group: #{e.response_body}"
end
using System;
using com.Messente.Api.Api;
using com.Messente.Api.Client;
using com.Messente.Api.Model;

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

            var api = new GroupsApi();

            try
            {
                api.DeleteGroup("5792a02a-e5c2-422b-a0a0-0ae65d814663");
                Console.WriteLine("API called successfully.");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling DeleteGroup: " + e.Message);
            }
        }
    }
}
curl -X DELETE \
  https://api.messente.com/v1/phonebook/groups/5792a02a-e5c2-422b-a0a0-0ae65d814663 \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD

Updates a group with the provided name

PUT https://api.messente.com/v1/phonebook/groups/{groupId}

Parameters

groupId=5792a02a-e5c2-422b-a0a0-0ae65d814663

Request Body

{
  "name": "Any group name"
}

Successful Response

HTTP 200
{
  "group": {
    "contactsCount": 1,
    "name": "Any group name",
    "id": "5792a02a-e5c2-422b-a0a0-0ae65d814663",
    "createdOn": "2019-04-22T11:46:23.753613Z"
  }
}
from messente_api import GroupsApi, ApiClient, Configuration
from messente_api.rest import ApiException

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

api = GroupsApi(ApiClient(configuration))

try:
    response = api.update_group(
        "5792a02a-e5c2-422b-a0a0-0ae65d814663", {"name": "Any group name"}
    )
    print(response)
except ApiException as e:
    print("Exception when calling update_group: %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.GroupsApi();

api.updateGroup(
  '5792a02a-e5c2-422b-a0a0-0ae65d814663',
  { 'name': 'Any group name' },
  (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 GuzzleHttp\Client;
use Messente\Api\Api\GroupsApi;

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

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

try {
  $response = $api->updateGroup('5792a02a-e5c2-422b-a0a0-0ae65d814663', [
    'name' => 'Any group name'
  ]);
  echo $response . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling updateGroup: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.GroupEnvelope;
import com.messente.api.GroupName;
import com.messente.api.GroupsApi;
import com.messente.auth.HttpBasicAuth;

public class UpdateGroupExample {
    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");

        GroupsApi api = new GroupsApi(apiClient);

        try {
            GroupEnvelope response = api.updateGroup("5792a02a-e5c2-422b-a0a0-0ae65d814663",
                    new GroupName().name("Any group name"));
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling updateGroup");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::GroupsApi.new

begin
  result = api.update_group(
    '5792a02a-e5c2-422b-a0a0-0ae65d814663',
    'name': 'Any group name'
  )
  p result.group
rescue MessenteApi::ApiError => e
  p "Exception when calling update_group: #{e.response_body}"
end
using System;
using com.Messente.Api.Api;
using com.Messente.Api.Client;
using com.Messente.Api.Model;

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

            var api = new GroupsApi();

            try
            {
                GroupEnvelope result = api.UpdateGroup(
                        "5792a02a-e5c2-422b-a0a0-0ae65d814663",
                        new GroupName("Any group name")
                    );
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling UpdateGroup: " + e.Message);
            }
        }
    }
}
curl -X PUT \
  https://api.messente.com/v1/phonebook/groups/5792a02a-e5c2-422b-a0a0-0ae65d814663 \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Any group name"
}'

Returns all groups

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

Successful Response

HTTP 200
{
  "groups": [
    {
      "contactsCount": 1,
      "name": "Any group name",
      "id": "5792a02a-e5c2-422b-a0a0-0ae65d814663",
      "createdOn": "2019-04-22T11:46:23.753613Z"
    }
  ]
}
from messente_api import GroupsApi, ApiClient, Configuration
from messente_api.rest import ApiException

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

api = GroupsApi(ApiClient(configuration))

try:
    response = api.fetch_groups()
    print(response)
except ApiException as e:
    print("Exception when calling fetch_groups: %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.GroupsApi();

api.fetchGroups((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 GuzzleHttp\Client;
use Messente\Api\Api\GroupsApi;

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

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

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

public class FetchGroupsExample {

    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");

        GroupsApi api = new GroupsApi(apiClient);

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

    }
}
require 'messente_api'

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

api = MessenteApi::GroupsApi.new

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

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

            var api = new GroupsApi();

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

Creates a new group with the provided name

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

Request Body

{
  "name": "Any group name"
}

Successful Response

HTTP 201
{
  "group": {
    "contactsCount": 1,
    "name": "Any group name",
    "id": "5792a02a-e5c2-422b-a0a0-0ae65d814663",
    "createdOn": "2019-04-22T11:46:23.753613Z"
  }
}
from messente_api import GroupsApi, ApiClient, Configuration
from messente_api.rest import ApiException

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

api = GroupsApi(ApiClient(configuration))

try:
    response = api.create_group({"name": "Any group name"})
    print(response)
except ApiException as e:
    print("Exception when calling create_group: %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.GroupsApi();

api.createGroup(
  { 'name': 'Any group name' },
  (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\GroupsApi;
use GuzzleHttp\Client;

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

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

try {
  $response = $api->createGroup([
    'name' => 'Any group name'
  ]);
  echo $response . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling createGroup: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.GroupEnvelope;
import com.messente.api.GroupName;
import com.messente.api.GroupsApi;
import com.messente.auth.HttpBasicAuth;

public class CreateGroupExample {
    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");

        GroupsApi api = new GroupsApi(apiClient);

        try {
            GroupEnvelope response = api.createGroup(new GroupName().name("Any group name"));
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling createGroup");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::GroupsApi.new

begin
  result = api.create_group('name': 'Any group name')
  p result.group
rescue MessenteApi::ApiError => e
  p "Exception when calling create_group: #{e.response_body}"
end
using System;
using com.Messente.Api.Api;
using com.Messente.Api.Client;
using com.Messente.Api.Model;

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

            var api = new GroupsApi();

            try
            {
                GroupEnvelope result = api.CreateGroup(new GroupName("Any group name"));
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling CreateGroup: " + e.Message);
            }
        }
    }
}
curl -X POST \
  https://api.messente.com/v1/phonebook/groups \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Any group name"
}'