Api reference MessageFlow
  • Welcome
  • Introduction
  • Authentication
  • REST clients samples
  • Long running actions - Retry-After header explained
  • Input compression
  • Using filters
  • Dynamic e-mail content
  • SMS Billing
  • Incoming webhooks
    • Steps to configure webhooks
    • Step 1: Identify the events to monitor
    • Step 2: Create a webhook endpoint
    • Step 3: Handle requests
    • Step 4: Test that your webhook
    • Step 4: Test your webhook
    • Step 5: Save your webhook configuration
  • External resources
  • Current Version
  • License
  • Groups
  • Contacts
  • Emails
  • Sms
  • Blacklist
  • Campaigns
  • Pushes
Powered by GitBook
On this page

Contacts

PreviousGroupsNextEmails

Contacts methods allows you to manage contacts that are identified by an unique externalId. Using externalId you can add, update, delete contacts, create groups and more.

List contacts

get

Use this method to get a list of all existing contacts.

Authorizations
Query parameters
offsetintegerOptional

The number of items omitted from the beginning of the list. Default ‘0’.

Default: 0
limitinteger · max: 1000Optional

The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.

Default: 100
groupintegerOptional

Get contacts from specified group id

idintegerOptional

Search for contact using contact id

externalIdstringOptional

The unique ID of the object you are looking for.

phoneNumberstringOptional

Search for contact using phone number

emailstringOptional

Search for contact using email address

inArchiveboolOptional

Search for archived contacts

archiveDateTostringOptional

Date in YYYY-MM-DD hh:mm:ii format to search archived contacts

Example: 2025-01-03 00:00:00
archiveDateFromstringOptional

Date in YYYY-MM-DD hh:mm:ii format to search archived contacts

Example: 2025-01-01 00:00:00
isUnsubscribeSmsboolOptional

Search for unsubscribe contacts sms

isUnsubscribeEmailboolOptional

Search for unsubscribe contacts email

isUnsubscribePushboolOptional

Search for unsubscribe contacts push

Responses
200
Request was successfully processed
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
get
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/contact?offset=0&limit=100&group=<integer>&id=<integer>&externalId=<string>&phoneNumber=<string>&email=<string>&inArchive=<bool>&archiveDateTo=2025-01-03 00:00:00&archiveDateFrom=2025-01-01 00:00:00&isUnsubscribeSms=<bool>&isUnsubscribeEmail=<bool>&isUnsubscribePush=<bool>");

            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": [
    {
      "companyName": "Example company",
      "createdAt": "2019-02-01 20:12:12",
      "email": "test@test.pl",
      "externalId": "XXX-XXX-XXX",
      "firstName": "First name",
      "id": "1",
      "lastName": "Last name",
      "phoneNumber": "123123123",
      "externalData": {
        "test": "test",
        "createdAt": "1989-09-28",
        "isClient": false
      },
      "inArchive": "false",
      "unsubscribeAllReason": "Last name",
      "unsubscribeAllTime": "2019-02-01 20:12:12",
      "unsubscribePushTime": "2019-02-01 20:12:12",
      "unsubscribeEmailTime": "2019-02-01 20:12:12",
      "unsubscribeSmsTime": "2019-02-01 20:12:12",
      "isUnsubscribeSms": "false",
      "isUnsubscribeEmail": "false",
      "isUnsubscribePush": "false"
    }
  ]
}

Add contact

post

Use this method to create a new contact object.

Authorizations
Body
itemsall ofOptional
and
Responses
200
Request was successfully processed
application/json
207
Some of request body items were not processed due to validation errors
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
post
using System.Threading.Tasks;

internal class Program
{
    private static void Main(string[] args)
    {
        string requestBody = "[{\"addToGroup\":[0],\"companyName\":\"Example company\",\"createdAt\":\"2019-02-01 20:12:12\",\"email\":\"test@test.pl\",\"externalId\":\"XXX-XXX-XXX\",\"firstName\":\"First name\",\"id\":\"1\",\"lastName\":\"Last name\",\"phoneNumber\":\"123123123\",\"externalData\":{\"test\":\"test\",\"createdAt\":\"1989-09-28\",\"isClient\":false},\"inArchive\":\"false\"}]";

        try {
            using var client = new HttpClient{};
            using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.messageflow.com/v2.1/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"
  },
  "data": [
    {
      "email": "test@test.pl",
      "externalId": "XXXX-XXXXX-XXXX",
      "id": "123",
      "phoneNumber": "0123123123"
    }
  ]
}

Update contact

put

Use this method to update details of certain contact.

Authorizations
Body
itemsone ofOptional
or
Responses
200
Request was successfully processed
application/json
207
Some of request body items were not processed due to validation errors
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
put
using System.Threading.Tasks;

internal class Program
{
    private static void Main(string[] args)
    {
        string requestBody = "[{\"externalId\":\"bfa0b1b1-e636-b8ab-aba4-78a913be0144\",\"data\":{\"companyName\":\"Example company\",\"email\":\"test@test.pl\",\"externalId\":\"XXX-XXX-XXX\",\"firstName\":\"First name\",\"id\":\"1\",\"lastName\":\"Last name\",\"phoneNumber\":\"123123123\",\"externalData\":{\"test\":\"test\",\"createdAt\":\"1989-09-28\",\"isClient\":false},\"inArchive\":\"false\"}}]";

        try {
            using var client = new HttpClient{};
            using var request = new HttpRequestMessage(HttpMethod.Put, "https://api.messageflow.com/v2.1/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"
  }
}

Delete contact

delete

Use this method to delete contact.

Authorizations
Body

The id of a object

idinteger[]Required

The id of a object

Example: 1
Responses
200
Request was successfully processed
application/json
207
Some of request body items were not processed due to validation errors
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
delete
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/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"
  }
}

Resubscribe contact

post

Use this method to resubscribe a contact from a single channel or all of them at once.

Authorizations
Path parameters
channelstring · enumRequired

Set in url.

Possible values:
Body

The id of a object

idinteger[]Required

The id of a object

Example: 1
Responses
200
Request was successfully processed
application/json
207
Some of request body items were not processed due to validation errors
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
post
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/contact/resubscribe/{channel}");

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

Unsubscribe contact

post

Use this method to unsubscribe a contact from a single channel or all of them at once.

Authorizations
Path parameters
channelstring · enumRequired

Set in url.

Possible values:
Body

The id of a object

idinteger[]Required

The id of a object

Example: 1
Responses
200
Request was successfully processed
application/json
207
Some of request body items were not processed due to validation errors
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
post
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/contact/unsubscribe/{channel}");

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

List groups for contact

get

Use this method to list all groups that the contact belongs to.

Authorizations
Path parameters
idstringRequired

The id of the contact.

Responses
200
Request was successfully processed
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
get
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/contact/{id}/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"
  },
  "data": []
}

Add group to contact

post

Use this method to add contact to an existing group.

Authorizations
Path parameters
idintegerRequired

The id of the contact.

Body

The id of a object

idinteger[]Required

The id of a object

Example: 1
Responses
200
Request was successfully processed
application/json
207
Some of request body items were not processed due to validation errors
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
post
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/contact/{id}/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"
  }
}

Delete groups from contact

delete

Action allows to delete groups from contact

Authorizations
Path parameters
idintegerRequired

The id of the contact.

Body

The id of a object

idinteger[]Required

The id of a object

Example: 1
Responses
200
Request was successfully processed
application/json
207
Some of request body items were not processed due to validation errors
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
delete
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/contact/{id}/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"
  }
}

List contact's additional fields

get

Use this method to list all additional fields added as externalData in ‘add contact’ method.

Authorizations
Query parameters
offsetintegerOptional

The number of items omitted from the beginning of the list. Default ‘0’.

Default: 0
limitinteger · max: 1000Optional

The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.

Default: 100
Responses
200
Request was successfully processed
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
get
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/contact/field?offset=0&limit=100");

            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": [
    {
      "fieldName": "text",
      "fieldType": "text"
    }
  ]
}

List segments

get

Use this method to list all segments created in your account panel.

Authorizations
Query parameters
offsetintegerOptional

The number of items omitted from the beginning of the list. Default ‘0’.

Default: 0
limitinteger · max: 1000Optional

The maximum number of items returned by request. Default ‘100’. Maximum ‘1000’.

Default: 100
Responses
200
Request was successfully processed
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
get
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/contact/segment?offset=0&limit=100");

            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": [
    {
      "id": "text",
      "name": "text",
      "createdTime": 1
    }
  ]
}

Get single segment

get

Use this method to get count of all contacts in the segment.

Authorizations
Path parameters
idstringRequired
Responses
200
Request was successfully processed
application/json
401
Authorization data is invalid
application/json
404
Request was successfully processed but no results were returned
application/json
500
Request was not processed due to server error
application/json
get
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/contact/segment/{id}");

            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": [
    {
      "count": 1
    }
  ]
}
  • GETList contacts
  • POSTAdd contact
  • PUTUpdate contact
  • DELETEDelete contact
  • POSTResubscribe contact
  • POSTUnsubscribe contact
  • GETList groups for contact
  • POSTAdd group to contact
  • DELETEDelete groups from contact
  • GETList contact's additional fields
  • GETList segments
  • GETGet single segment