Inhalt

GET Get message

https://api.getback.ch/v1/push/message/MESSAGE_ID
HEADERS
AuthorizationBasic API_KEY
curl --location --request GET "https://api.getback.ch/v1/push/message/MESSAGE_ID" \
  --header "Authorization: Basic API_KEY"
{
    "message": {
        "id": 6035,
        "autohide": false,
        "send_at": null,
        "sent_at": "2019-07-23 15:38:42",
        "is_draft": false,
        "is_silent": false,
        "ttl": null,
        "ttl_date": null,
        "rate_limit": false,
        "updated_at": "2019-07-23 13:51:15",
        "urgency": "normal",
        "is_hidden_in_widget": false,
        "lang": {
            "de": {
                "title": "Test",
                "body": "Test",
                "icon": "https://example.com/icon.png",
                "image": "https://example.com/image.jpg",
                "link": "https://example.com"
            }
        },
        "stats": {
            "failed": 0,
            "displays": 6,
            "clicks": 0,
            "conversions": 0,
            "ordervalue": 0,
            "recipients": 16,
            "sent": 16,
            "pending": 0
        },
        "created_at": "2019-07-23 15:38:41"
    }
}

GET Get messages

https://api.getback.ch/v1/push/messages
HEADERS
AuthorizationBasic API_KEY
Body
is_draft optionalintegerWith the parameter is_draft=1 all messages with the status Draft can be retrieved.
curl --location --request GET "https://api.getback.ch/v1/push/messages" \
  --header "Authorization: Basic API_KEY"
{
    "messages": [
        {
            "id": 6035,
            "is_draft": false,
            "send_at": null,
            "sent_at": "2019-07-23 15:38:42",
            "stats": {
                "failed": 0,
                "displays": 6,
                "clicks": 0,
                "conversions": 0,
                "ordervalue": 0,
                "recipients": 16,
                "sent": 16,
                "pending": 0
            },
            "created_at": "2019-07-23 15:38:41",
            "is_silent": false,
            "is_hidden_in_widget": false,
            "autohide": false,
            "rate_limit": false
        }
    ]
}

POST Create message

https://api.getback.ch/v1/push/message
HEADERS
AuthorizationBasic API_KEY
Content-Typeapplication/json
Body
is_draftbooleanDefines whether a message is to be created as a draft. Default: true To send a message immediately, this value must be set to false.
subscription optionalarrayArray of Subscription IDs to be written to directly (direct message). Example: ["Z_7aWWIpvtKMPP01", "2-2VuH6bwnbhrmdo"]
campaign_id optionalstringUse only in conjunction with the subscription parameter. The campaign ID can be used to group the results of the direct messages in the Getback Dashboard. If no campaign ID is passed, the results will be assigned to the default campaign.
audience_id optionalstringID of the recipient group defined in the Getback backend.
ttl optionalintegerValidity of the message in minutes from the time of dispatch. Do not use together with ttl_date. Default: 1140 (3 days)
ttl_date optionalstringDate and time up to which the message should be valid. Do not use with ttl. Format: yyyy-MM-dd HH:mm
autohide optionalboolean / integerTime how long a message remains in place before it is hidden and moved to the Notification Center. Default: false
rate_limit optionalintegerNumber of messages per minute. Default: 0 = No rate limit.
urgency optionalstringIf the priority is low, messages may be delivered with a delay, e.g. to avoid having to wake up the device when the battery level is low. Possible values: 'very-low' | 'low' | 'normal' | 'high' Default: 'normal'
is_silent optionalbooleanFor mobile devices only. Message is delivered without audio/vibration/display activation. Default: false
is_hidden_in_widget optionalbooleanIf true is transmitted, the message does not appear in the Getback Push Widget. Default: false
send_at optionalstringDate and time at which the message is to be sent. If no value is transferred, the message is sent immediately. Format: yyyy-MM-dd HH:mm
lang optionalobjectMessage content divided by language. The language-specific elements must be defined within a key that corresponds to the language code (de, en, fr, etc.).
titlestringMessage title
bodystringMessage body
linkstringLink to Landingpage
icon optionalstringLink to message icon
badge optionalstringLink to badge icon which is displayed in the notification bar on Mobile (Chrome on Android).
image optionalstringLink to large image in message. This feature is only supported by Chrome on Desktop.
action_buttons optionalarray objectAdd action buttons to the message. Example: [{"text":"Button 1", "link": "https://example.org/page1"}, {"text":"Button 2", "link": "https://example.org/page2"}]
curl --location --request POST "https://api.getback.ch/v1/push/message" \
  --header "Content-Type: application/json" \
  --header "Authorization: Basic API_KEY" \
  --data "{
	\"is_draft\": true,
	\"ttl\": 600,
        \"ttl_date\": "2019-08-08 10:05",
	\"autohide\": false,
	\"rate_limit\": false,
	\"urgency\": \"normal\",
	\"is_silent\": false,
	\"is_hidden_in_widget\": false,
	\"send_at\": null,
	\"lang\": {
		\"de\": {
			\"title\": \"Testnachricht mda\",
			\"body\": \"Testbody mda\",
			\"link\": \"https://example.org\",
                        \"icon\":\"https://example.org/icon.png\",
                        \"badge\":\"https://example.org/badge.png\",
			\"image\": \"https://static.getback.ch/media/192x192/adfocuslogo(2).png\",
			\"action_buttons\" : [
				{
					\"text\":\"Button 1\",
					\"link\": \"https://example.org/page1\"
				},
				{
					\"text\":\"Button 2\",
					\"link\": \"https://example.org/page2\"
				}
				]
		}
	}
}"
body
message_idintegerID of the created message
{
    "message_id": MESSAGE_ID
}

PUT Edit message

https://api.getback.ch/v1/push/message/MESSAGE_ID
HEADERS
AuthorizationBasic API_KEY
Content-Typeapplication/json
curl --location --request PUT "https://api.getback.ch/v1/push/message/6335" \
  --header "Authorization: Basic API_KEY" \
  --header "Content-Type: application/json" \
  --data "{
	\"is_draft\": false,
	\"ttl_date\": \"2019-08-03 05:04\",
	\"autohide\": 60,
	\"rate_limit\": 0,
	\"urgency\": \"low\",
	\"is_silent\": false,
	\"is_hidden_in_widget\": true,
	\"send_at\": \"2019-07-31 10:30\",
	\"lang\": {
		\"de\": {
			\"title\": \"Testnachricht\",
			\"body\": \"Testbody\",
			\"link\": \"https://example.org\",
			\"icon\": \"https://example.org/icon.png\",
			\"badge\": \"https://example.org/badge.png\",
			\"image\": \"https://example.org/image.png\",
			\"action_buttons\" : [
				{
					\"text\":\"Button 1\",
					\"link\": \"https://example.org/page1\"
				},
				{
					\"text\":\"Button 2\",
					\"link\": \"https://example.org/page2\"
				}
				]
		}
	}
}"
{
    "success": true
}

DELETE Delete message

https://api.getback.ch/v1/push/message/MESSAGE_ID
HEADERS
AuthorizationBasic API_KEY
{
    "success": true
}

How do I get the Subscription ID of a subscriber?

The Subscription ID of the subscriber which is needed for direct messages (parameter subscription) is stored in the variable window.gb_push_subscription_key. If this ID is changed, the event getback_push_subscription_change is fired. This allows you, for example, to save the ID in your CRM and send personalized direct messages to your subscribers.

window.addEventListener("getback_push_subscription_change", function() { 
    console.log(window.gb_push_subscription_key);
});

Create direct message campaign

You can use a direct message campaign to group the results of the messages sent. This enables you to evaluate your individual actions separately.

You can create campaigns in the Getback Backend under “API -> Create campaign”. In order to use the campaign afterwards when creating a message, the ID must be passed using the parameter campaign_id.

GET Get campaign stats

https://api.getback.ch/v1/stats/campaigns
HEADERS
Authorization optionalBasic API_KEY
Body
startstringStart date of the date period Format: yyyy-MM-dd
endstringEnd date of the date period Format: yyyy-MM-dd
status optionalstringFilter status by active or inactive campaigns (default = all) Available values : active, inactive, all
curl --location --request GET "https://api.getback.ch/v1/stats/campaigns?start=2021-12-01&end=2021-12-31&status=active" \
  --header "Authorization: Basic API_KEY"
[
  {
    "id": 0,
    "name": "string",
    "impressions": 0,
    "clicks": 0,
    "conversions": 0,
    "ordervalue": 0
  }
]