Відстеження часового поясу та мови контакту
Ви можете записати часовий пояс та мову контакту двома способами:
- через API.
- за допомогою SDK (при передаванні даних з фронтенду мобільного додатка).
Примітка
Передавайте дані про мову у форматі RFC 5646 з додатковим мовнимй підтегом у форматі ISO 639-1. Приклад: de-AT
Дані про часовий пояс потрібно передавати у форматі TZ database. Приклад: Europe/Kyiv
Важливо
Атрибути (мова, часовий пояс тощо) відстежуються лише для контактів із зовнішніми ID.
API-методи
Використовуйте метод API Add/update a contact, щоб додати новий або оновити існуючий контакт, та метод Add/update contacts для масового додавання/оновлення даних контактів.
Приклад запиту Add/update a contact
curl --request POST \ --url https://api.esputnik.com/api/v1/contact \ --header 'accept: application/json; charset=UTF-8' \ --header 'authorization: Basic your_api_key \ --header 'content-type: application/json' \ --data ' { "channels": [ { "type": "email", "value": "john@example.com" } ], "languageCode": "en-us", "timeZone": "Europe/Kyiv", "firstName": "John", "lastName": "Smith", "externalCustomerId": "24233" } '
JSON
Приклад запиту Add/update contacts
curl --request POST \ --url https://api.reteno.com/api/v1/contacts \ --header 'accept: application/json; charset=UTF-8' \ --header 'authorization: Basic your_api_key \ --header 'content-type: application/json' \ --data ' { "contacts": [ { "channels": [ { "type": "email", "value": "john@example.com" } ], "firstName": "John", "lastName": " Smith", "languageCode": "en-US", "timeZone": "Europe/Kyiv", "externalCustomerId": "543323" } ], "dedupeOn": "externalCustomerId" } '
JSON
iOS SDK
Записуйте атрибути контакту, такі як часовий пояс та мову, за допомогою наступного методу:
Reteno.updateUserAttributes(externalUserId: "USER_ID", userAttributes: UserAttributes, subscriptionKeys: [String], groupNamesInclude: [String], groupNamesExclude: [String])
Swift
Приклад об'єкту UserAttributes:
func saveUser() { let attributes = UserAttributes( phone: user.phone, email: user.email, firstName: user.firstName, lastName: user.lastName, languageCode: "en-US", timeZone: "Europe/Kyiv" ) Reteno.updateUserAttributes(externalUserId: user.id, userAttributes: attributes) }
Swift
Android SDK
Методи додавання атрибутів контакту:
Reteno.setUserAttributes(String externalUserId, User user)
Java
Reteno.setUserAttributes(externalUserId: String, user: User?)
Kotlin
Приклад об'єкта UserAttributes:
fun setLanguageTimeZone() { val userId = "UserIdHere" val userAttributes = UserAttributes( languageCode = "en-US", timeZone = "Europe/Kyiv" ) val user = User( userAttributes = userAttributes, subscriptionKeys = listOf("key1", "key2", "key3") ) application.getRetenoInstance().setUserAttributes(userId, user) }
Kotlin
React Native SDK
Метод додавання атрибутів контакту:
import { setUserAttributes } from 'reteno-react-native-sdk'; setUserAttributes({ externalUserId: "USER_ID", user: { attributes: userAttributes, subscriptionKeys: string[], groupNamesInclude: string[], groupNamesExclude: string[] } })
TypeScript
Приклад об'єкта UserAttributes:
setUserAttributes({ externalUserId, user: { userAttributes: { languageCode: "de-AT", timeZone: "Europe/Kyiv", }, }, );
TypeScript