Groups
This API mainly allows you to add, update, delete and list contacts but also you can unsubscribe and resubscribe contact or list segments.
Use this method to list all contacts in a group.
The group id that should be searched
The number of items omitted from the beginning of the list. Default ‘0’.
0
The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.
100
Allows you to select the field by which the sort should be performed. ( For this method: id, createdAt )
id
It allows you to set the sort order for a given field. ( ASC or DESC )
DESC
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.messageflow.com/v2.1/group/{groupId}/contact?offset=0&limit=100&orderBy=id&orderDirection=DESC");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
},
"data": [
{
"email": "[email protected]",
"externalId": "XXXX-XXXXX-XXXX",
"id": "123",
"phoneNumber": "0123123123"
}
]
}
Use this method to add contacts to a group.
The id of the group.
The id of a object
The id of a object
1
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "{\"id\":[1]}";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.messageflow.com/v2.1/group/{groupId}/contact");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}
Use this method to delete contacts from a group.
The id of the group.
The id of a object
The id of a object
1
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "{\"id\":[1]}";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.messageflow.com/v2.1/group/{groupId}/contact");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}
Use this method to list all groups.
The number of items omitted from the beginning of the list. Default ‘0’.
0
The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.
100
Specifies a required order for the query results. You can order only by id, createdAt and name.
id
Specifies the sort order. To sort the groups in descending order, use DESC to sort in ascending order, use ASC.
DESC
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.messageflow.com/v2.1/group?offset=0&limit=100&orderBy=id&orderDirection=DESC");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
},
"data": [
{
"createdAt": 1,
"id": 1234,
"name": "test",
"description": "Test descr"
}
]
}
Use this method to create a group that you can use to send email and sms campaigns.
Group object
The group name.
test
The group description.
Test descr
The unique identifier of the group
XXXXX-XXXX-XXXX
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "[{\"name\":\"test\",\"description\":\"Test descr\",\"externalId\":\"XXXXX-XXXX-XXXX\"}]";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.messageflow.com/v2.1/group");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}
Use this method to update a group.
Group object
The id of the group.
1234
The unique name of the group.
test
The group description.
Test descr
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "[{\"id\":1234,\"name\":\"test\",\"description\":\"Test descr\"}]";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Put, "https://api.messageflow.com/v2.1/group");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}
Use this method to delete an existing group.
The id of a object
The id of a object
1
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "{\"id\":[1]}";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.messageflow.com/v2.1/group");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}
Use this method to count number of contacts in group (either dynamic or static). When using this method for getting dynamic group count you may get response with Retry-After header. Please check chapter 'Long running actions - Retry-After header explained'.
The id of the group.
using System.Threading.Tasks;
internal class Program
{
private static void Main(string[] args)
{
string requestBody = "";
try {
using var client = new HttpClient{};
using var request = new HttpRequestMessage(HttpMethod.Get, "https://api.messageflow.com/v2.1/group/{groupId}/count");
request.Headers.Add("Authorization", "YourAuthorizationKey");
request.Headers.Add("Application-Key", "YourApplicationKey");
request.Content = new StringContent(requestBody, null, "application/json");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string content = await response.Content.ReadAsStringAsync();
Console.WriteLine(content);
} catch (HttpRequestException e) {
Console.WriteLine("\n Exception Caught!\n Message :{0} ", e.Message);
}
}
}
{
"meta": {
"numberOfErrors": 0,
"numberOfData": 1,
"status": 200,
"uniqId": "00d928f759"
}
}