Component subscriptions
Asked by Asher Francis:

Hi

We want to subscribe distribution groups to components. How do we go about this? Can we do this from the back end or do we need to go to the actual statuspage and click the "Subscribe" button next to the component and enter the email address?

Thanks

Asher


Answers:
author: Dave Parrish _Atlassian_
body: Hi [@Asher Francis](/t5/user/viewprofilepage/user-id/3853341) , it's Dave from Statuspage. The reason you don't see the API endpoint that Carmen refers to is that it was deprecated recently (see our post about [abuse mitigation](https://community.atlassian.com/t5/Statuspage-articles/Abuse-mitigation-for-Statuspage-email-SMS-and-webhook/ba-p/1234356) for details).

Instead, you should use our authenticated API, which provides an endpoint for create subscribers. Here are the docs for that endpoint:

<https://developer.statuspage.io/#operation/postPagesPageIdSubscribers>

So you'd be doing a POST to this URL:

<https://api.statuspage.io/v1/pages/PAGE_ID/subscribers>

(Be sure to replace the PAGE_ID with the alphanumeric ID for your page.)

You can specify a list of components to subscribe in the body of the request. Here's an example body:

```
{
  "subscriber": {
    "email": "dave@example.com",
    "component_ids": [ "COMPONENT_ID_1", "COMPONENT_ID_1" ]
  }
}
```

The COMPONENT_ID values should of course be replaced by the alphanumeric IDs for the components in question.

If you want to update the list of subscribed components for an existing subscriber, you can do a PATCH for that specific subscriber, as described here:

<https://developer.statuspage.io/#operation/patchPagesPageIdSubscribersSubscriberId>

Hope this helps!

comments: author: Asher Francis
body: Thanks Dave! This worked a treat


author: Carmen Nadeau
body: Hi Asher,

You can do this with the API.

There is a conversation in the community regarding this question

<https://community.atlassian.com/t5/Statuspage-questions/Update-a-subscriber-s-component-with-API/qaq-p/1009708>

comments: author: Asher Francis
body: Hi Carmen

Thanks for this and for your answer on my other question

Unfortunately the suggestion in this article doesn't work - going to /api on my statuspage, there is no option for subscribers

Ideally, we'd like to silently subscribe distribution groups to components

Can you provide any more information on this?

We're also on the business subscription

Thanks

Asher


author: Carmen Nadeau
body: Hi again,

It worked for us. We use this for each subscriber:

PATCH <https://api.statuspage.io/v1/{page_id}/subscribers/{subscriber_id>}

and send to the page the jason file with the list of components for this subscriber


author: Asher Francis
body: Hi Carmen

Thanks for this.

This assumes that users are already subscribed. How would we add subscribers from the API?

Thanks


author: Carmen Nadeau
body: Hi Asher,

We have automated the creation of a subscriber list (a csv file) from our active directory.

With one of the API we download our page's subscribers and put them in a second list.

We compare the 2 lists and if there is an email from our active directory csv file that is missing from the pages's subscribers list, we subscribe those.

It allows us to automate the subscription of any new employe


Tags: cloud