Skip to main content

Groups

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:

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

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

Retrieve a group

Endpoint

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"
}
}

Using a library

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)

Delete a group

Endpoint

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

Parameters

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

Successful Response

HTTP 204

Using a library

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)

Update a group with the provided name

Endpoint

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"
}
}

Using a library

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)

List all groups

Endpoint

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"
}
]
}

Using a library

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)

Create a new group with the provided name

Endpoint

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"
}
}

Using a library

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)