Skip to content

Register Push Notification binding

Enrolls an account user's device in the push notification service.

Authentication required

Requires account user level access or CAN_ACCESS_CUSTOMER_QUERIES permission.

Arguments

Returns

mutation RegisterPushNotificationBinding($input: RegisterPushNotificationBindingInput!) {
    registerPushNotificationBinding(input: $input) {
        pushNotificationBinding {
            user {
                givenName
                familyName
            }
            application {
                bundleId
                description
                name
                service
            }
            token
            registeredAt
            expiresAt
        }
    }
}
1
2
3
4
5
# Input variables
"input": {
    "token": "some-unique-token-goes-over-here",
    "bundleId": "some-bundle-id",
}

Example

mutation RegisterPushNotificationBinding($input: RegisterPushNotificationBindingInput!) {
    registerPushNotificationBinding(input: $input) {
        pushNotificationBinding {
            user {
                givenName
                familyName
            }
            application {
                bundleId
                description
                name
                service
            }
            token
            registeredAt
            expiresAt
        }
    }
}
1
2
3
4
"input": {
    "token": "1ef8ba141f3718d1e7627bc295207b5fd13b8069e968adb8df0201a3eefe",
    "bundleId": "test.app.bundle.id",
}
import pprint

import requests

# API_URL = "https://api.oeus-kraken.energy/v1/graphql/" # prod
API_URL = "https://api.oeus-kraken.systems/v1/graphql/" # test
JWT_TOKEN = "PLACE_JWT_TOKEN_HERE"
HEADERS = {
    "Authorization": f"JWT {JWT_TOKEN}"
}

MUTATION = """
mutation RegisterPushNotificationBinding($input: RegisterPushNotificationBindingInput!) {
    registerPushNotificationBinding(input: $input) {
        pushNotificationBinding {
            user {
                givenName
                familyName
            }
            application {
                bundleId
                description
                name
                service
            }
            token
            registeredAt
            expiresAt
        }
    }
}
"""

VARIABLES = {
    "input": {
        "token": "1ef8ba141f3718d1e7627bc295207b5fd13b8069e968adb8df0201a3eefe",
        "bundleId": "test.app.bundle.id",
    }
}

session = requests.Session()
session.headers.update(HEADERS)
response = session.post(
    url=API_URL,
    json={"query": MUTATION, "variables": VARIABLES}
)
pprint.pprint(response.json())
const axios = require("axios")

// const apiUrl = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test

const jwtToken = "PLACE_JWT_TOKEN_HERE"

let headers = {
  "Authorization": `JWT ${jwtToken}`
}

const mutation = `
mutation RegisterPushNotificationBinding($input: RegisterPushNotificationBindingInput!) {
    registerPushNotificationBinding(input: $input) {
        pushNotificationBinding {
            user {
                givenName
                familyName
            }
            application {
                bundleId
                description
                name
                service
            }
            token
            registeredAt
            expiresAt
        }
    }
}
`

const variables = {
    "input": {
        "token": "1ef8ba141f3718d1e7627bc295207b5fd13b8069e968adb8df0201a3eefe",
        "bundleId": "test.app.bundle.id",
    }
}

axios({
  url: apiUrl,
  method: "post",
  data: {
    query: mutation,
    variables: variables,
  },
  headers: headers,
}).then((response) => {
  console.log(JSON.stringify(response.data, null, 4));
});
import axios from 'axios';

// const API_URL = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
export const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test

export const jwtToken = "PLACE_JWT_TOKEN_HERE"

let headers = {"Authorization": `JWT ${jwtToken}`}

export const mutation = `
mutation RegisterPushNotificationBinding($input: RegisterPushNotificationBindingInput!) {
    registerPushNotificationBinding(input: $input) {
        pushNotificationBinding {
            user {
                givenName
                familyName
            }
            application {
                bundleId
                description
                name
                service
            }
            token
            registeredAt
            expiresAt
        }
    }
}
`

export const variables = {
    "input": {
        "token": "1ef8ba141f3718d1e7627bc295207b5fd13b8069e968adb8df0201a3eefe",
        "bundleId": "test.app.bundle.id",
    }
}

axios({
  url: apiUrl,
  method: "post",
  data: {
    query: mutation,
    variables: variables,
  },
  headers: headers,
}).then((response) => {
  console.log(JSON.stringify(response.data, null, 4));
});
{
    "data": {
        "registerPushNotificationBinding": {
            "pushNotificationBinding": {
                "user": {
                    "givenName": "john",
                    "familyName": "doe",
                },
                "application": {
                    "bundleId": "test.app.bundle.id",
                    "description": "some-description",
                    "name": "some-application-name",
                    "service": "GCM",
                },
                "token": "1ef8ba141f3718d1e7627bc295207b5fd13b8069e968adb8df0201a3eefe",
                "registeredAt": "2022-02-17T08:35:18.935761-05:00",
                "expiresAt": "2022-05-17T08:35:18.935761-05:00",
            }
        }
    },
}
Back to top