Create a topic subscription
POST {{baseUrl}}/subscriptions
Set a user's subscription status to subscribed for a particular topic (and optional categories). If the user previously unsubscribed, the user will be resubscribed.
Request Body
{"subscription"=>{"categories"=>[{"slug"=>"<string>", "reason"=>"<string>"}, {"slug"=>"<string>", "reason"=>"<string>"}], "topic"=>"<string>"}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
X-MAGICBELL-API-KEY | string | (Required) The (public) API key of your MagicBell project. | |
X-MAGICBELL-USER-EXTERNAL-ID | string | ID of the user. Provide the X-MAGICBELL-USER-EMAIL header instead if you identify users by email. | |
X-MAGICBELL-USER-EMAIL | string | Email address of the user. Provide the X-MAGICBELL-USER-EXTERNAL-ID header instead if you identify users by ID. | |
X-MAGICBELL-USER-HMAC | string | HMAC calculated with the API secret and ID, or email, of the user. Required if the project has HMAC enabled. | |
Content-Type | string | ||
Accept | string |
RESPONSES
status: OK
{"subscription":{"categories":[{"slug":"\u003cstring\u003e","reason":"\u003cstring\u003e","status":"subscribed"},{"slug":"\u003cstring\u003e","reason":"\u003cstring\u003e","status":"unsubscribed"}],"topic":"\u003cstring\u003e"}}