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_api_send_message

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

Request Body

NameTypeDescription

app_id*

String

APP_ID provided by Swing2App

app_api_key*

String

API KEY provided by Swing2App

send_target_list*

String

Send destination type setting items When sending to indiviUser ID to send to user_id in single dispatch When sending multiple messages, separate them with “,” Ex:) user_id1,user_id2 Enter -1 [When sending all ] Ex:) -1

send_type*

String

Enter the send type. Enter "push" in case of push delivery

message_title*

String

message title

message_content*

String

message content

message_image_url

String

image url (Optional)

message_link_url

String

link url (Optional)

{
    // 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("app_api_key", "api_key");
form.append("send_target_list", "test");
form.append("send_type", "push");
form.append("message_title", "title");
form.append("message_content", "content");
form.append("message_image_url", "https://www.swing2app.com/assets/images/logo.png");
form.append("message_link_url", "https://www.swing2app.com/");

var settings = {
  "url": "https://www.swing2app.com/swapi/push_api_send_message",
  "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 apiKey = "test_api_key";
var appId = "test_app_id";
var sendTargetList = '-1';
$.ajax({
    url: "https://www.swing2app.co.kr/swapi/push_api_send_message",
    type: "post",
    dataType: "json",
    data : {
        app_id : appId,
        send_target_list : sendTargetList,
        send_type : 'push' ,
        message_title:'title',
        message_content:'content',
        message_image_url: 'https://www.swing2app.com/assets/images/logo.png',
        message_link_url: 'https://www.swing2app.com/',
        app_api_key : apiKey
    },
    success: function (model) {
        console.log("success");

    }
});

[JavaScript Implementation Example – Individual Push notification]

var apiKey = "test_api_key";
var appId = "test_app_id";
var sendTargetList = 'user_id';
$.ajax({
    url: "https://www.swing2app.co.kr/swapi/push_api_send_message",
    type: "post",
    dataType: "json",
    data : {
        app_id : appId,
        send_target_list : sendTargetList,
        send_type : 'push' ,
        message_title:'title',
        message_content:'message',
        message_image_url: 'https://www.swing2app.com/assets/images/logo.png',
        message_link_url: 'https://www.swing2app.com/',
        app_api_key : apiKey
    },
    success: function (model) {
        console.log("success");

    }
});

Last updated