Skip to content

Instantly share code, notes, and snippets.

@wthrajat
Last active December 17, 2025 19:17
Show Gist options
  • Select an option

  • Save wthrajat/51886db4949b270d5835eb52943106a0 to your computer and use it in GitHub Desktop.

Select an option

Save wthrajat/51886db4949b270d5835eb52943106a0 to your computer and use it in GitHub Desktop.
Simple JS code for node healthcheck ping
async function sendHealthCheck() {
const now = new Date();
const timestamp = now
.toISOString()
.replace(/\.\d{3}/, '')
.replace('Z', '+0000');
const signature = 'your signature here';
const graphqlMutation = {
query: `
mutation HealthCheck($signature: String!, $timestamp: String!) {
healthCheck(signature: $signature, timestamp: $timestamp)
}
`,
variables: {
signature: signature,
timestamp: timestamp,
},
};
try {
const response = await fetch('https://api.amboss.space/graphql', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(graphqlMutation),
});
const result = await response.json();
if (result.errors) {
console.error('GraphQL Errors:', result.errors);
} else {
console.log('Heartbeat sent successfully:', result.data.healthCheck);
}
} catch (err) {
console.error('Failed to send heartbeat:', err);
}
}
await sendHealthCheck();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment