Phonebook API

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

Contacts

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
  • Fetch Contact details
  • Create a new Contact
  • Update an existing Contacts
  • Add or remove a Contact from a Group
  • Delete a Contact

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

Lists a contact

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"
  }
}
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)
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_USERNAME';

const api = new MessenteApi.ContactsApi();

api.fetchContact('+37251000000', (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\ContactsApi;

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

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

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

public class FetchContactExample {

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

        ContactsApi api = new ContactsApi(apiClient);

        try {
            ContactEnvelope response = api.fetchContact("+37251000000");
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling fetchContact");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::ContactsApi.new

begin
  result = api.fetch_contact('+37251000000')
  p result.contact
rescue MessenteApi::ApiError => e
  p "Exception when calling fetch_contact: #{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 FetchContactExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            var api = new ContactsApi();

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

Deletes a contact

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

Parameters

phone=%2B37251000000

Successful Response

HTTP 204
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)
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_USERNAME';

const api = new MessenteApi.ContactsApi();

api.deleteContact('+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 GuzzleHttp\Client;
use Messente\Api\Api\ContactsApi;

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

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

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

public class DeleteContactExample {

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

        ContactsApi api = new ContactsApi(apiClient);

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

    }
}
require 'messente_api'

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

api = MessenteApi::ContactsApi.new

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

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

            var api = new ContactsApi();

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

Updates a contact

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"
  }
}
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)
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_USERNAME';

const api = new MessenteApi.ContactsApi();

api.updateContact(
  '+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',
  },
  (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\ContactsApi;

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

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

try {
  $response = $api->updateContact('+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'
  ]);
  echo $response . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling updateContact: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.ContactEnvelope;
import com.messente.api.ContactUpdateFields;
import com.messente.api.ContactsApi;
import com.messente.auth.HttpBasicAuth;

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

        ContactsApi api = new ContactsApi(apiClient);

        try {
            ContactUpdateFields fields = new ContactUpdateFields();
            fields.email("anyone@messente.com");
            fields.firstName("Any");
            fields.lastName("One");
            fields.company("Messente");
            fields.title("Sir");
            fields.custom("Any custom");
            fields.custom2("Any custom two");
            fields.custom3("Any custom three");
            fields.custom4("Any custom four");
            ContactEnvelope response = api.updateContact("+37251000000", fields);
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling updateContact");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::ContactsApi.new

begin
  result = 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'
  )
  p result.contact
rescue MessenteApi::ApiError => e
  p "Exception when calling update_contact: #{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 UpdateContactExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            var api = new ContactsApi();

            try
            {
                var fields = new ContactUpdateFields(
                    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"
                );
                ContactEnvelope result = api.UpdateContact("+37251000000", fields);
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling UpdateContact: " + e.Message);
            }
        }
    }
}
curl -X PATCH \
  'https://api.messente.com/v1/phonebook/contacts/+37251000000' \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD \
  -H 'Content-Type: application/json' \
  -d '{
    "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"
}'

Lists groups of a contact

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"
    }
  ]
}
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)
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_USERNAME';

const api = new MessenteApi.ContactsApi();

api.fetchContactGroups('+37251000000', (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\ContactsApi;

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

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

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

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

        ContactsApi api = new ContactsApi(apiClient);

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

    }
}
# frozen_string_literal: true

require 'messente_api'

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

api = MessenteApi::ContactsApi.new

begin
  result = api.fetch_contact_groups('+37251000000')
  p result.groups
rescue MessenteApi::ApiError => e
  p "Exception when calling fetch_contact_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 FetchContactGroupsExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            var api = new ContactsApi();

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

Returns all contacts

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"
    }
  ]
}
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)
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_USERNAME';

const api = new MessenteApi.ContactsApi();

api.fetchContacts(
  {
    groupIds: [
      '5792a02a-e5c2-422b-a0a0-0ae65d814663',
      '4792a02a-e5c2-422b-a0a0-0ae65d814662',
    ],
  },
  (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\ContactsApi;

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

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

try {
  $groupIds = array(
    '5792a02a-e5c2-422b-a0a0-0ae65d814663',
    '4792a02a-e5c2-422b-a0a0-0ae65d814662'
  );
  $response = $api->fetchContacts($groupIds);
  echo $response . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling fetchContacts: ', $e->getMessage(), PHP_EOL;
}
?>
import java.util.ArrayList;
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.ContactListEnvelope;
import com.messente.api.ContactsApi;
import com.messente.auth.HttpBasicAuth;

public class FetchContactsExample {

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

        ContactsApi api = new ContactsApi(apiClient);

        try {
            ArrayList<String> groupIds = new ArrayList<String>();
            groupIds.add("5792a02a-e5c2-422b-a0a0-0ae65d814663");
            groupIds.add("4792a02a-e5c2-422b-a0a0-0ae65d814662");
            ContactListEnvelope response = api.fetchContacts(groupIds);
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling fetchContacts");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::ContactsApi.new

begin
  # issue: all contacts are returned even when group ids are provided
  result = api.fetch_contacts(
    group_ids: [
      '5792a02a-e5c2-422b-a0a0-0ae65d814663',
      '4792a02a-e5c2-422b-a0a0-0ae65d814662'
    ]
  )
  p result.contacts
rescue MessenteApi::ApiError => e
  p "Exception when calling fetch_contacts: #{e.response_body}"
end
using System;
using System.Collections.Generic;
using com.Messente.Api.Api;
using com.Messente.Api.Client;
using com.Messente.Api.Model;

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

            var api = new ContactsApi();

            try
            {
                var groupIds = new List<string>();
                groupIds.Add("5792a02a-e5c2-422b-a0a0-0ae65d814663");
                groupIds.Add("4792a02a-e5c2-422b-a0a0-0ae65d814662");
                ContactListEnvelope result = api.FetchContacts(groupIds);
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling FetchContacts: " + e.Message);
            }
        }
    }
}
curl -X GET \
  'https://api.messente.com/v1/phonebook/contacts?groupIds=b94a9361-b924-4f47-842e-d24fa47dafcb&groupIds=5792a02a-e5c2-422b-a0a0-0ae65d814663' \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD

Creates a new contact

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"
  }
}
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)
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_USERNAME';

const api = new MessenteApi.ContactsApi();

api.createContact(
  {
    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',
  },
  (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\ContactsApi;

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

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

try {
  $response = $api->createContact([
    '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'
  ]);
  echo $response . PHP_EOL;
} catch (Exception $e) {
  echo 'Exception when calling createContact: ', $e->getMessage(), PHP_EOL;
}
?>
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.ContactEnvelope;
import com.messente.api.ContactFields;
import com.messente.api.ContactsApi;
import com.messente.auth.HttpBasicAuth;

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

        ContactsApi api = new ContactsApi(apiClient);

        try {
            ContactFields fields = new ContactFields();
            fields.phoneNumber("+37251000000");
            fields.email("anyone@messente.com");
            fields.firstName("Any");
            fields.lastName("One");
            fields.company("Messente");
            fields.title("Sir");
            fields.custom("Any custom");
            fields.custom2("Any custom two");
            fields.custom3("Any custom three");
            fields.custom4("Any custom four");
            ContactEnvelope response = api.createContact(fields);
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling createContact");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::ContactsApi.new

begin
  result = 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'
  )
  p result.contact
rescue MessenteApi::ApiError => e
  p "Exception when calling create_contact: #{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 CreateContactExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            var api = new ContactsApi();

            try
            {
                var fields = new ContactFields(
                    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"
                );
                ContactEnvelope result = api.CreateContact(fields);
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling CreateContact: " + e.Message);
            }
        }
    }
}
curl -X POST \
  'https://api.messente.com/v1/phonebook/contacts' \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD \
  -H 'Content-Type: application/json' \
  -d '{
    "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"
}'

Adds a contact to a group

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

Parameters

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

Successful Response

HTTP 201
{}
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)
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_USERNAME';

const api = new MessenteApi.ContactsApi();

api.addContactToGroup(
  '5792a02a-e5c2-422b-a0a0-0ae65d814663',
  '+37251000000',
  (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\ContactsApi;

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

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

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

public class AddContactToGroupExample {

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

        ContactsApi api = new ContactsApi(apiClient);

        try {
            String groupId = "5792a02a-e5c2-422b-a0a0-0ae65d814663";
            EmptyObject response = api.addContactToGroup(groupId, "+37251000000");
            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling addContactToGroup");
            e.printStackTrace();
        }

    }
}
require 'messente_api'

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

api = MessenteApi::ContactsApi.new

begin
  result = api.add_contact_to_group(
    '5792a02a-e5c2-422b-a0a0-0ae65d814663',
    '+37251000000'
  )
  p result
rescue MessenteApi::ApiError => e
  p "Exception when calling add_contact_to_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 AddContactToGroupExample
    {
        static void Main(string[] args)
        {
            Configuration.Default.Username = "YOUR_MESSENTE_API_USERNAME";
            Configuration.Default.Password = "YOUR_MESSENTE_API_PASSWORD";

            var api = new ContactsApi();

            try
            {
                EmptyObject result = api.AddContactToGroup(
                    "5792a02a-e5c2-422b-a0a0-0ae65d814663",
                    "+37251000000"
                );
                Console.WriteLine(result.ToJson());
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception when calling AddContactToGroup: " + e.Message);
            }
        }
    }
}
curl -X POST \
  'https://api.messente.com/v1/phonebook/groups/5792a02a-e5c2-422b-a0a0-0ae65d814663/contacts/+37251000000' \
  -u YOUR_MESSENTE_API_USERNAME:YOUR_MESSENTE_API_PASSWORD

Removes a contact from a group

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

Parameters

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

Successful Response

HTTP 204
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)
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_USERNAME';

const api = new MessenteApi.ContactsApi();

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

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

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

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

public class RemoveContactFromGroupExample {

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

        ContactsApi api = new ContactsApi(apiClient);

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

    }
}
require 'messente_api'

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

api = MessenteApi::ContactsApi.new

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

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

            var api = new ContactsApi();

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