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

Pushes

PreviousCampaigns

Push API allows you to send push notifications with images and buttons.

Send push

post

Use this method to send mobile push notifications.

Authorizations
Body
applicationsstring[] · min: 1Required

The id of applications to which we want to send push notification.

Example: XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
defaultLanguagestringRequired

The default language for translating push in Unicode language identifier representation.

Example: pl
imagestring · max: 250Optional

The absolute URL of image. Image requirements:

Android:

aspect ratio 2/1
format JPG PNG GIF
dimensions:
min 512x256
balanced 1044x720
max 2088x1440

iOS

size < 10MB
format JPG PNG GIF
dimensions max 2436x2436
Example: http://absolute.url/to/image
silentbooleanOptional

Should notification be silent or not.

Default: false
soundstring · max: 250Optional

The push sound. Use resource name or ‘DEAFULT’ string

Example: sound-file.wav
scheduleTimestringOptional

The date the Push will be set off.

Example: 2020-01-01 12:12:12Pattern: /^\d{4}-\d{2}-\d{2}\s*(?:\d{2}:\d{2}(?::\d{2})?)?$/
ttlnumberOptional

The unix timestamp parameter specifying the maximum lifetime of notification. Must be in future. The push service will try to deliver the notification to the receiver until the specified day.

Example: 1540377351
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
post
using System.Threading.Tasks;

internal class Program
{
    private static void Main(string[] args)
    {
        string requestBody = "{\"applications\":[\"XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\"],\"to\":{\"receiver\":\"example-device-id\",\"externalId\":\"xxx-xxx-xxx-xxx\",\"type\":1},\"title\":{\"pl\":\"test\",\"en\":\"test\"},\"body\":{\"pl\":\"test\",\"en\":\"test\"},\"defaultLanguage\":\"pl\",\"image\":\"http:\\/\\/absolute.url\\/to\\/image\",\"silent\":false,\"sound\":\"sound-file.wav\",\"scheduleTime\":\"2020-01-01 12:12:12\",\"ttl\":1540377351,\"externalData\":{\"test\":\"x\",\"test1\":false},\"advanced\":[],\"action\":[],\"actionButtons\":{\"button\":1,\"icon\":\"my_icon.png\",\"action\":[]}}";

        try {
            using var client = new HttpClient{};
            using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.messageflow.com/v2.1/push");

            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": [
    {
      "receiver": "example-device-id",
      "externalId": "xxx-xxx-xxx-xxx",
      "type": 1
    }
  ]
}

Add event

post

Use this method to create a new event.

Authorizations
Body
extIdstringOptional

ExternalId of contact.

emailstringOptional

Valid email address.

numberstringOptional

Phone number in format +48XXXXXXXXX.

eventNamestringOptional

Name of the event.

userDataobjectOptional

Field with non standard values.

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 = "[{\"extId\":\"\",\"email\":\"\",\"number\":\"\",\"eventName\":\"\",\"userData\":[],\"additionalStringFields\":{\"some_field_name\":\"some_field_value\",\"some_field_name2\":\"some_field_value2\"},\"additionalBoolFields\":{\"some_bool_field\":true,\"some_bool_field2\":false},\"additionalNumericFields\":{\"some_numeric_field_name\":123,\"some_numeric_field_name2\":124},\"additionalDateFields\":{\"some_date_field_name\":1584112094}}]";

        try {
            using var client = new HttpClient{};
            using var request = new HttpRequestMessage(HttpMethod.Post, "https://api.messageflow.com/v2.1/event");

            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"
  }
}
  • POSTSend push
  • POSTAdd event