Subscribers Resource

The Subscribers Resource endpoint helps you perform operations on subscribers.

Endpoint

https://propagate.at/api/v1/subscribers


GET /

Returns an array of all the subscribers in the group.

note

Make sure your request body is sent in the JSON Format.

Body Parameters

groupId string required

The ID of the group that you want to fetch the subscribers of.

tip

To get the ID of a group/audience you created, use the GET /groups API endpoint.

or you can...

  • open the group in the dashboard,
  • open Chrome Network Tab,
  • search backyard requests,
  • refresh
  • see the getGroup query response,
  • you will see the group _id there.

Example Request

curl
-X GET
-H 'Content-Type: application/json'
-H "Authorization: Bearer {{API_SECRET_KEY}}"
--data '{"groupId": "5f8d3478d4a3c807e3127593"}'
https://propagate.at/api/v1/subscribers

Example Response

{
"data": {
"subcribers": [
{
"_id": "5f8d43e2d4a3c807e3127596",
"integration": "EMAIL",
"identifier": "someemail@gmail.com",
"subscriberToken": "u0ThXAEQNu5OPBsoV5l5kQHZvefb7ZNu0rhDMif9Tk8n85JeTPQLXrhyLqtOmYAzAcTC3LejBxNBeRNs2TK9egq",
"group": "5f8d3478d4a3c807e3127593",
"extraData": {},
"createdAt": "2020-10-19T07:44:34.628Z",
"updatedAt": "2020-10-19T07:44:34.628Z"
},
{
"_id": "5f8d43e2d4a3c807e3127597",
"integration": "WHATSAPP",
"identifier": "+14567408909",
"subscriberToken": "n1LAQgmrzlVIHXAM3P4TqXvZR4ZN1tpTjfSuxhFh6xkKDOsa96U4bsPfcOJHvoPDF0phxKzyAuowGwA2cSUYZXU",
"group": "5f8d3478d4a3c807e3127593",
"extraData": {},
"createdAt": "2020-10-19T07:44:34.628Z",
"updatedAt": "2020-10-19T07:44:34.628Z"
},
...
]
}
}

POST /

Creates a Subscriber in a group.

note

This API request creates and registers a subscriber instantly without any verification. If you are subscribing a user to your newsletter using this endpoint, you will have to verify the email from your end.

API endpoint to verify a subscriber coming soon :)

Body Parameters

integration enum email | whatsapp | sms required

The service that subscriber is using to join the newsletter.

identifier string required

If integration=email then identifier needs to be a valid email.

If integration=whatsapp then identifier needs to be a valid WhatsApp Number.

If integration=sms then identifier needs to be a valid SMS number.

groupSlug string required

The slug of the group/audience that the subscriber is subscribing to.

extraData json optional

Does the subscriber have a "name"? Or some "address"? Or anything custom information? Then you can dump the information here in a JSON Object format.

The extraData object will be later used to fill dynamic data like {{name}} when you compose a message.

Example Request

curl
-X POST
-H 'Content-Type: application/json'
-H "Authorization: Bearer {{API_SECRET_KEY}}"
--data '{"integration": "WHATSAPP", "identifier": "213 621 0002", "groupSlug": test-group", "extraData": {"name": "John Doyle"}}'
https://propagate.at/api/v1/subscribers

Example Response

{
"data": {
"subscribe": {
"integration": "WHATSAPP",
"identifier": "+12136210002",
"group": "5f97f8963de2575b7888301c",
"user": "5f72e09e613a120856e80da7",
"subscriberToken": "h5rEcnZn1esbZKHAPpEetBUEtPx6YNsCT7TdbwtHEKFGuMTsMeIcbvxkU1VSBWZ9GAhsh6GrP4cdLW10aGHUbaL",
"extraData": {
"name": "John Doyle"
},
"createdAt": "2020-10-27T10:40:22.058Z",
"updatedAt": "2020-10-27T10:40:22.058Z",
"_id": "5f97f9163de2575b7888301d",
"isVerified": true
}
}
}

DELETE /

Deletes/Unsubscribes multiple subscribers in a group.

Body Parameters

groupId string required

The ID of the group you are deleting subscribers from.

subscriberIds [string] required

An array of Subscriber IDs. The array consists IDs of the subscribers to be deleted from a group.

Example Request

curl
-X DELETE
-H 'Content-Type: application/json'
-H "Authorization: Bearer {{API_SECRET_KEY}}"
--data '{"groupId": "5f97f8963de2575b7888301c", "subscriberIds": ["5f97f9163de2575b7888301d", "5f97f9163de2575b7888301f"]}'
https://propagate.at/api/v1/subscribers

Example Response

{
"data": {
"deleteSubcribers": {
"result": {
"n": 2,
"ok": 1
},
"deletedCount": 2,
"ids": [
"5f97f9163de2575b7888301d",
"5f97f9163de2575b7888301f"
]
}
}
}

Ending note

If you got any questions, feel free to drop us those at hey[at]propagate.at. We will help!