Skip to main content

Subscription Sync

Keep subscription status synchronized between edrone and your e-commerce platform.

Two-way sync

  1. Platform → edrone: Send subscription changes to edrone
  2. edrone → Platform: Receive webhook when status changes in edrone

Send subscription to edrone

# Subscribe user
curl -X POST https://api.edrone.me/trace \
-d "app_id=YOUR_APP_ID" \
-d "sender_type=server" \
-d "action_type=subscribe" \
-d "email=john@example.com" \
-d "subscriber_status=1"

# Unsubscribe user
curl -X POST https://api.edrone.me/trace \
-d "app_id=YOUR_APP_ID" \
-d "sender_type=server" \
-d "action_type=subscribe" \
-d "email=john@example.com" \
-d "subscriber_status=0"

Receive webhook from edrone

Configure a webhook endpoint to receive subscription changes from edrone.

Webhook payload

{
"email": "john@example.com",
"subscriber_status": 0,
"reason": "unsubscribed_by_user",
"timestamp": "2024-01-15T10:30:00Z"
}

Example webhook handler

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/webhooks/edrone/subscription', methods=['POST'])
def handle_subscription_webhook():
data = request.json

email = data['email']
subscribed = data['subscriber_status'] == 1
reason = data.get('reason', '')

# Update your database
update_user_subscription(email, subscribed, reason)

return jsonify({'status': 'ok'}), 200

Status reasons

ReasonDescription
unsubscribed_by_userUser clicked unsubscribe link
unsubscribed_by_adminAdmin unsubscribed user
bouncedEmail bounced
complainedUser marked as spam

Configure webhook in Mission Control

  1. Go to SettingsIntegrationsWebhooks
  2. Add your endpoint URL
  3. Select Subscription status change event
  4. Save and test

SMS subscription sync

Include sms_subscriber_status for SMS subscriptions:

curl -X POST https://api.edrone.me/trace \
-d "app_id=YOUR_APP_ID" \
-d "sender_type=server" \
-d "action_type=subscribe" \
-d "email=john@example.com" \
-d "phone=+1234567890" \
-d "subscriber_status=1" \
-d "sms_subscriber_status=1"