Releva has completed an $870,000 financial round led by New Vision Fund 3 with participation by HR Capital AD, Verto Invest and the investment arm of private investors.
Releva завърши финансов рунд от $870 000, воден от Фонд Ню Вижън 3 с участието на Ейч Ар Капитал АД, Верто Инвест и подкрепата на частни инвеститори.
Search the Documentations
Categories

Subscribe (Frontend)

Releva provides this API so you can subscribe users via the frontend.

How is this different from the regular Subscribe API?

This API uses access token for authentication instead of a secret key and can therefore be used in the frontend. Never call any APIs that use a secret key from your frontend!

What this API does depends on the Subscription request behavior setting in your shop settings page.

  • If the behavior is set to Wait for confirmation (the default setting), calling this API will emit a subscribeRequest event, which you can use to trigger a campaign with an email to welcome the user and ask them to confirm their subscription using the {{subscribeLink}} merge tag. This is a very secure approach, even if used on the frontend.
  • If the behavior is set to Subscribe right away, calling this API will subscribe the user, just like the Subscribe API. but it will also tag the resulting subscribe event with tag request. Since your accessToken is meant for frontend use, anyone can scrape it off your shop and a malicious user may use it to mass subscribe users without their knowledge. To mitigate this, you can use a triggered campaign based on subscribe events with tag request, and send an email welcoming the user, and offering them a link to unsubscribe in case they have been subscribed in error.

IMPORTANT: If unsure which option is the right one for you, shoot us an email at support@releva.ai!

Request Format

The API accepts the following curl equivalent:

curl -H 'Content-Type: application/json' -H 'Authorization: Bearer <accessToken>' -XPOST https://releva.ai/api/v0/subscribe/request -d'{
  "email": "support@releva.ai", "subscriptions": ["list1", "list2"], "unsubscribeLink": "...", "addSubscriptions": true
}'

OPTIONAL: You may use the subscriptions field to set specific subscriptions, for example, “newsletter”, “weekly promo”, etc. and use these tags when building segments to target users that have subscribed for the corresponding item. When a user has updated their subscription preferences, you should call this API with the new set of subscriptions.

OPTIONAL: You may send unsubscribeLink if your shop has unique unsubscribe links for each user. This will take precedence over the unsubscribe link configured in your shop settings.

OPTIONAL: You may send addSubscriptions if you want to add the subscriptions to the current subscriptions for the user. If this is not set we would replace the current subscriptions with the ones from the request.

Response Format

A successful request will return a JSON response with HTTP status 202 and an empty body ({}). If an error is encountered, an appropriate HTTP status code will be returned along with a body describing the error ({“message”: “…”})

If the email address in the request is not tracked in Releva, the request will generate a profile with that address.

Previous Profile Delete
Next Profile Register
Table of Contents