Real-Time Contact Updating
We recommend regularly updating contacts via the Backend API (server-to-server) when some contact updates happen in your app's backend and frontend.
Let’s consider updating contacts in detail.
Using Backend API
Transfer contact data to eSputnik using the Add/update a contact API method.
The method creates a new or updates an existing contact in real time (synchronously). This means when you receive the 200 response you can be sure that contact data is already actualized in eSputnik.
For example, you can use the Add/update a contact method to collect data on subscription changes.
Features:
- One request allows you to add or update one contact.
- If a contact card with an identifier from the request already exists in eSputnik, it will be updated. A contact will be created with all additional data from the request if it hasn't existed.
Method type: POST. The description of the method, fields, and request body format are available here.
URL to send request: https://api.esputnik.com/api/v1/contact
NoteIf you send two consecutive requests for the same contact with an identical request body, the second one returns
429 Too Many Requests— this is a deduplication safeguard, separate from the general rate limit. Sending requests with different data for the same contact doesn't trigger it.The safeguard covers identical requests sent within a minute and applies to the
v1/contactresource only. Events sent tov2/eventare not deduplicated: identical events are all accepted and all appear in the event history.
NoteTo clear a contact's email channel via
v1/contactwhen identifying the contact byexternalCustomerIdor phone, listcontactFieldsfor the update and omit it from thechannelsarray. You don't need to passnullvalues — the channel is removed as long as"contactFields": ["email"]is passed andchannels. The same approach works for the Add/update contacts resource.
NoteA field that isn't passed in an update request doesn't erase the previously saved value. For example, if a contact was created with an email address and a phone number, and the next request passes only the phone number, the email address is kept.
You need to obtain an API key and use it for authentication. This key provides access to your eSputnik account, so make sure to keep it secure and never expose it publicly or through insecure communication channels.
API Use Case for Web-to-App Project
-
A user has completed onboarding on the site (answered the questionnaire questions).
-
The
Add/update a contactAPI method creates a contact profile with data collected on the site and external ID as the main identifier. -
The user has downloaded and opened the mobile app.
-
SDK creates the anonymous contact with the Device ID.
-
The user logged in to the app.
-
The
SetUserAttributesrequest with the external ID updates the existing contact with the Device ID and push token and deletes the anonymous contact.
Updated about 19 hours ago