Sending a push notification By API

Using the push API to send Swing2App push notifications.

Swing2App provides the following method to send push messages sent from the dashboard in the form of APIs.

In the case of API use not agreed in advance and indiscriminate mass shipment, the use may be restricted.

This API is available to users of paid apps.

  • API Specification

API for sending push notification to Swing2App application

POST https://www.swing2app.com/swapi/push_send

*** App ID and API KEY that need to be issued can be issued upon request to the customer center. **

Request Body

{
    // Response
    result : true, // message id 
    userCount : 3 , // sent user count
    remainSmsCount 0, 
    isPaymentSms : F
}
  • Code example

var form = new FormData();
form.append("app_id", "app_id");
form.append("api_user", "UserAccount");
form.append("api_key", "api_key");
form.append("send_target_list", "test");
form.append("send_target_type_list", "MEMBER");
form.append("send_type", "push");
form.append("message_json", "{\"messageTitle\" : \"push title\" , \"messageContent\" : \"push content\" , \"messageLinkUrl\" : \"http://www.swing2app.com\" , \"messageImageUrl\":\"http://www.swing2app.com/abc.png\"}");

var settings = {
  "url": "https://www.swing2app.com/swapi/push_send",
  "method": "POST",
  "timeout": 0,
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

[JavaScript Implementation Example – Send All]

var apiUserId = "help@swing2app.com";
var apiKey = "test_api_key";
var appId = "test_app_id";
var messageJson = '{ "messageTitle" : "push title" , "messageContent" : "push content" , 
"messageLinkUrl" : "https://www.swing2app.com" , "messageImageUrl" : "https://www.swing2app.com/abc.png" }';
var sendTargetList = '-1';
var sendTargetTypeList = "ALL_TARGET";
$.ajax({
    url: "https://www.swing2app.co.kr/swapi/push_send",
    type: "post",
    dataType: "json",
    data : {
        app_id : appId,
        send_target_list : sendTargetList,
        send_target_type_list : sendTargetTypeList,
        send_type : 'push' ,
        message_json : messageJson,
        api_user : apiUserId,
        api_key : apiKey
    },
    success: function (rModel) {
        console.log("success");

    }
});

[JavaScript Implementation Example – Individual Push notification]

var apiUserId = "help@swing2app.co.kr";
var apiKey = "test_api_key";
var appId = "test_app_id";
var messageJson = '{ "messageTitle" : "push title" , "messageContent" : "push content"}';
var sendTargetList = 'user_id';
var sendTargetTypeList = "MEMBER";
$.ajax({
    url: "https://www.swing2app.co.kr/swapi/push_send",
    type: "post",
    dataType: "json",
    data : {
        app_id : appId,
        send_target_list : sendTargetList,
        send_target_type_list : sendTargetTypeList,
        send_type : 'push' ,
        message_json : messageJson,
        api_user : apiUserId,
        api_key : apiKey
    },
    success: function (rModel) {
        console.log("success");

    }
});

Last updated