Enter your API key in the Authorization
field like the example shown below:E.g ApiKey 18d2e625f05d80e
import co.novu.common.base.Novu;
import co.novu.api.subscribers.requests.UpdateSubscriberPreferenceRequest;
import co.novu.api.subscribers.responses.SingleSubscriberPrefResponse;
public class Main {
public static void main(String[] args) {
String apiKey = "<NOVU_SECRET_KEY>";
Novu novu = new Novu(apiKey);
String subscriberId = "<SUBSCRIBER_ID>";
String templateId = "<TEMPLATE_ID>";
PreferenceChannel channel = new PreferenceChannel();
channel.setType("<TYPE>");
channel.setEnabled(true);
UpdateSubscriberPreferenceRequest request = new UpdateSubscriberPreferenceRequest();
request.setEnabled(false);
request.setChannel(channel);
SingleSubscriberPrefResponse response = novu.updateSubscriberPreferences(request, subscriberId, templateId);
}
}
{
"data": {
"preference": {
"channels": {
"chat": "boolean",
"email": "boolean",
"in_app": "boolean",
"push": "boolean",
"sms": "boolean"
},
"enabled": "boolean"
},
"template": {
"_id": "string",
"critical": "boolean",
"name": "string"
}
}
}
API key authentication. Allowed headers-- "Authorization: ApiKey <api_key>".
The subscriber preferences for every ChannelTypeEnum for the workflow assigned.
Sets if the workflow is fully enabled for all channels or not for the subscriber.
The workflow information and if it is critical or not
The preferences of the subscriber regarding the related workflow