N
Novu2mo ago
christian

Problem with PATCH subscriber

I'm tring to turn off the in-app notifications for a subscriber using the api But as you can see from the result I'm getting back it does not stick. The in_app notification channel is still enabled. What am i missing?
curl -X PATCH \
'https://api.novu.co/v1/subscribers/56f137d2-a642-4964-bd56-7f2119c359e6/preferences/672b8e95453679ea5584c82e' \
-H 'Content-Type: application/json' \
-H 'Authorization: ApiKey <redacted>' \
-d '{
"channel": {
"type": "in_app",
"enabled": false
}
}'

{"data":{"template":{"_id":"672b8e95453679ea5584c82e","name":"recipe_comment_new_in_app","tags":[],"critical":false,"triggers":[{"type":"event","identifier":"recipe_comment_new_in_app","variables":[],"reservedVariables":[],"subscriberVariables":[],"_id":"672b8e95453679ea5584c82f","id":"672b8e95453679ea5584c82f"}],"data":{"schema":{"type":"object","properties":{"commenterName":{"type":"string"},"image":{"type":"string"},"recipeTitle":{"type":"string"},"url":{"type":"string"}},"required":["commenterName","recipeTitle","url"],"additionalProperties":false},"unknownSchema":{"type":"object","properties":{"commenterName":{"type":"string"},"image":{"type":"string"},"recipeTitle":{"type":"string"},"url":{"type":"string"}},"required":["commenterName","recipeTitle","url"],"additionalProperties":false}}},"preference":{"enabled":true,"channels":{"in_app":true},"overrides":[{"channel":"in_app","source":"subscriber"}]},"type":"WORKFLOW_RESOURCE"}}⏎
curl -X PATCH \
'https://api.novu.co/v1/subscribers/56f137d2-a642-4964-bd56-7f2119c359e6/preferences/672b8e95453679ea5584c82e' \
-H 'Content-Type: application/json' \
-H 'Authorization: ApiKey <redacted>' \
-d '{
"channel": {
"type": "in_app",
"enabled": false
}
}'

{"data":{"template":{"_id":"672b8e95453679ea5584c82e","name":"recipe_comment_new_in_app","tags":[],"critical":false,"triggers":[{"type":"event","identifier":"recipe_comment_new_in_app","variables":[],"reservedVariables":[],"subscriberVariables":[],"_id":"672b8e95453679ea5584c82f","id":"672b8e95453679ea5584c82f"}],"data":{"schema":{"type":"object","properties":{"commenterName":{"type":"string"},"image":{"type":"string"},"recipeTitle":{"type":"string"},"url":{"type":"string"}},"required":["commenterName","recipeTitle","url"],"additionalProperties":false},"unknownSchema":{"type":"object","properties":{"commenterName":{"type":"string"},"image":{"type":"string"},"recipeTitle":{"type":"string"},"url":{"type":"string"}},"required":["commenterName","recipeTitle","url"],"additionalProperties":false}}},"preference":{"enabled":true,"channels":{"in_app":true},"overrides":[{"channel":"in_app","source":"subscriber"}]},"type":"WORKFLOW_RESOURCE"}}⏎
2 Replies
christian
christianOP2mo ago
Is it a bug ? now its working, probably a glitch of some sort?
{"data":{"preference":{"channels":{"in_app":true},"enabled":true},"template":{"_id":"672b8e95453679ea5584c82e","name":"recipe_comment_new_in_app","critical":false,"triggers":[{"identifier":"recipe_comment_new_in_app","type":"event","variables":[]}]}}}⏎
{"data":{"preference":{"channels":{"in_app":true},"enabled":true},"template":{"_id":"672b8e95453679ea5584c82e","name":"recipe_comment_new_in_app","critical":false,"triggers":[{"identifier":"recipe_comment_new_in_app","type":"event","variables":[]}]}}}⏎
Richard Fontein
Richard Fontein2mo ago
Hi @christian , we identified an edge case where using the Subscriber Preference API with new Workflows resulted in the preference resolution not respecting Subscriber Preferences. The fix was deployed yesterday afternoon, that's why you're seeing the correct behaviour now 🙏
Want results from more Discord servers?
Add your server