Skip to content

Пользователь кликнул по сообщению

Событие нажатия/клика/перехода сообщения передается в момент, когда пользователь нажал на уведомление и перешел на целевой экран.

POST https://api.rees46.ru/track/clicked

Параметры

TODO

Актуализировать список параметров

ПараметрОбязателен?Описание
shop_idДаAPI-ключ
typeДаТип сообщения: bulk, chain, transactional
codeДаУникальный код сообщения

Запрос

TODO

Ревью параметров мобильных SDK. Доделать Android.

Пример запроса:

shell
curl 'https://api.rees46.ru/track/clicked' \
    -X 'POST' \
    -H 'Content-Type: application/json' \
    --data-raw '{"shop_id":"SHOP_ID", "code":"CODE", "type":"TYPE"}'
swift
sdk.notificationClicked(code: "i7ykuagkjgfs", type: "bulk")
kotlin
// Add notification identification data to the intent
intent.putExtra( REES46.NOTIFICATION_TYPE, data["type"])
intent.putExtra( REES46.NOTIFICATION_ID, data["id"])

// Add click tracking in the method of activity creation
override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)
    // Для отслеживания кликов по уведомлению
    if (intent.extras != null) {
      sdk.notificationClicked(intent.extras)
    }
}
java
// Add notification identification data to the intent
intent.putExtra(REES46.NOTIFICATION_TYPE, data.get("type"));
intent.putExtra(REES46.NOTIFICATION_ID, data.get("id"));

// Add click tracking in the method of activity creation
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //For tracking notification clicked
    if( getIntent().getExtras() != null ) {
        REES46.notificationClicked(getIntent().getExtras());
    }
}
javascript
// Код и тип можно взять из тела push-уведомления
const params = {
  code: 'CODE',
  type: 'TYPE'
};

// Track when user clicked the notification
sdk.notificationClicked(params);

Ответ

Пример ответа сервера:

json
{
  "status": "success"
}

В случае ошибки ответ будет в формате:

json
{
  "status": "error",
  "payload": {
    "message": "Code is not valid"
  }
}