Skip to content

Latest commit

 

History

History
159 lines (123 loc) · 3.07 KB

get-subscriber.mdx

File metadata and controls

159 lines (123 loc) · 3.07 KB
openapi
get /v1/subscribers/{subscriberId}
import { Novu } from '@novu/node';

const novu = new Novu("<NOVU_API_KEY>");

const response = await novu.subscribers.get("subscriberId");
console.log(response.data);
curl --request GET \
  --url https://api.novu.co/v1/subscribers/{subscriberId} \
  --header 'Authorization: <authorization>'
import requests

url = "https://api.novu.co/v1/subscribers/{subscriberId}"

headers = {"Authorization": "<authorization>"}

response = requests.request("GET", url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: '<authorization>'}};

fetch('https://api.novu.co/v1/subscribers/{subscriberId}', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.novu.co/v1/subscribers/{subscriberId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: <authorization>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://api.novu.co/v1/subscribers/{subscriberId}"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<authorization>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
import co.novu.common.base.Novu;
import co.novu.api.subscribers.responses.SingleSubscriberResponse;

public class Main {
   public static void main(String[] args) {
      String apiKey = "<NOVU_API_KEY>";
      Novu novu = new Novu(apiKey);
      String subscriberId = "<SUBSCRIBER_ID>";

      SingleSubscriberResponse response = novu.getSubscriber(subscriberId);
  }
}
{
  "data": {
    "_id": "string",
    "firstName": "string",
    "lastName": "string",
    "email": "string",
    "phone": "string",
    "avatar": "string",
    "locale": "string",
    "subscriberId": "string",
    "channels": [
      {
        "providerId": "slack",
        "integrationIdentifier": "string",
        "credentials": {
          "webhookUrl": "string",
          "channel": "string",
          "deviceTokens": [
            "string"
          ]
        },
        "_integrationId": "string"
      }
    ],
    "isOnline": "boolean",
    "lastOnlineAt": "string",
    "_organizationId": "string",
    "_environmentId": "string",
    "deleted": "boolean",
    "createdAt": "string",
    "updatedAt": "string",
    "__v": "number"
  }
}