Search code examples
phpapirestactivecollab

Add Subscribers to Discussion via Active Collab API


We are currently customizing our Active Collab 5.6.4 Self Hosted installation. I'm trying to add subscribers for a discussion through the api - I'm using the following api method

PUT /subscribers/task/1

(see https://developers.activecollab.com/api-documentation/v1/utilities/notifications/subscribers.html)

But the examples in there are only for adding subscribers to tasks - how do I add subscribers to discussions? I tried using

PUT /subscribers/discussions/1

That does not do anything, also this does not yield any error so I think there must be a method somehow already. Does anybody know which method should be used to add subscribers to discussions?


Solution

  • Subscribers can be added by POST-ing a list of new subscribers to /subscribers/discussion/:discussion_id. You need to POST a JSON object wtih a list of subscribers, where each subscriber can be:

    1. An ID of existing user in the system,
    2. An email address of a user,
    3. An array, where first element is user's name and second is user's address.

    An example payload:

    {
        "s1": 12,
        "s2": "[email protected]",
        "s3": [
            "Another Anonymous",
            "[email protected]"
        ]
    }
    

    POST adds subscribers to existing subscribers. PUT on the other hand will replace all existing subscribers with the new list. DELETE clears the subscribers list.