updatePreference method

Future<SubscriberPreference> updatePreference(
  1. String subscriberId,
  2. String templateId,
  3. String channel,
  4. bool value,
)

Update subscriber preference Activates or deactivates a channel for a subscriber on a specific template (workflow)

subscriberId - The external subscriber identifier templateId - The internal template identifier channel - The channel to update value - The new value for the channel

Implementation

Future<SubscriberPreference> updatePreference(String subscriberId, String templateId, String channel, bool value) async {
  Map<String, dynamic> response = await request(
    method: ApiMethod.PATCH,
    endpoint: 'subscribers/$subscriberId/preferences/$templateId',
    data: {
      'channel': {
        'type': channel,
        'enabled': value,
      },
    }
  );
  return SubscriberPreference.fromJson(response['data']);
}