Download OpenAPI specification:Download
POST /destination
to register a new webhook Destination. See Create a new Destination.GET /destination
to view all your webhook Destinations. See Get all Destinations.PATCH /destination/:id
to modify a Destination. See Update an existing Destination. DELETE /destination/:id
to remove a specific webhook Destination. See Delete a Destination.Triggering message forwarding
$ENV/$TEAM_ID/m
are forwarded, with the exception of messages sent to $ENV/$TEAM_ID/m/d/$DEVICE_ID/d2c/bin
.x-nrfcloud-signature
header to verify incoming requests. This signature is an HMAC hex digest of the request payload, hashed using your provided secret. Employ constant-time string comparisons to mitigate timing attacks.verifySsl
property in your webhook configuration.errors
property of the Destination to review the five most recent errors within the past 30 days.Below is an example of a simple Node.js server that receives webhook requests, verifies the x-nrfcloud-signature
header, and responds with a status code of 200 along with the x-nrfcloud-team-id
header. This example uses
Express, a popular web framework for Node.js, and the crypto module for signature verification.
const express = require('express');
const bodyParser = require('body-parser');
const crypto = require('crypto');
const app = express();
const port = 3000;
// Replace this with your actual secret key
const secretKey = 'yourSecretKey';
app.use(bodyParser.json());
// Verify nRF Cloud signature
const verifySignature = (req) => {
const signature = req.headers['x-nrfcloud-signature'];
const body = JSON.stringify(req.body);
// Create HMAC hex digest
const hmac = crypto.createHmac('sha256', secretKey);
hmac.update(body, 'utf8');
const digest = hmac.digest('hex');
return digest === signature;
};
app.post('/webhook', (req, res) => {
if (verifySignature(req)) {
// Your logic here - process the request
// Respond with 200 OK and x-nrfcloud-team-id header
res.set('x-nrfcloud-team-id', 'yourTeamId');
res.status(200).send('Webhook received successfully.');
} else {
res.status(401).send('Invalid signature.');
}
});
app.listen(port, () => {
console.log(`Webhook receiver running on port ${port}`);
});
Returns a list of all Destinations registered to your team.
[- {
- "id": "string",
- "createdAt": "string",
- "name": "string",
- "config": {
- "type": "http",
- "url": "string",
- "verifySsl": true
}, - "isEnabled": true,
- "errors": [
- {
- "reason": {
- "message": "Received non 2xx response from webhook destination",
- "response": {
- "status": 404,
- "body": "Not Found"
}
}, - "createdAt": "string",
- "correlationId": "string"
}
], - "dlqSize": 0,
- "dlqNotificationEmails": [
- "user@example.com"
]
}
]
Registers a new Destination to forward device messages from nRF Cloud.
During the request, the service verifies your provided Destination. Before creating a new Destination, ensure your server responds appropriately.
nRF Cloud needs to verify that you own this endpoint and that it is ready to start receiving data.
The service sends a POST request to the URL endpoint you provided. Your endpoint should respond with a 2xx status code and the header x-nrfcloud-team-id
with your team ID.
If the verification process fails, the request responds with a 400 status code and the Destination is not registered.
name required | string non-empty |
required | object (HttpConfiguration) |
isEnabled required | boolean If |
dlqNotificationEmails | Array of strings (Email) [^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2...] The email address to which DLQ notifications are sent. |
{- "name": "string",
- "config": {
- "secret": "string",
- "token": "string",
- "type": "http",
- "url": "string",
- "verifySsl": true
}, - "isEnabled": true,
- "dlqNotificationEmails": [
- "user@example.com"
]
}
{- "id": "string",
- "createdAt": "string",
- "name": "string",
- "config": {
- "type": "http",
- "url": "string",
- "verifySsl": true
}, - "isEnabled": true,
- "errors": [
- {
- "reason": {
- "message": "Received non 2xx response from webhook destination",
- "response": {
- "status": 404,
- "body": "Not Found"
}
}, - "createdAt": "string",
- "correlationId": "string"
}
], - "dlqSize": 0,
- "dlqNotificationEmails": [
- "user@example.com"
]
}
Sends a verification message to your Destination for testing purposes.
required | Nominal-string-.Uuid.- (string) <uuid> = 36 characters ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3... Examples: a5592ec1-18ae-4d9d-bc44-1d9bd927bbe9 Universally unique identifier |
{- "destination_response": {
- "status": 200,
- "body": {
- "message": "Hello, world!"
}, - "headers": {
- "content-type": "application/json"
}
}
}
Modifies an existing Destination to forward device messages from nRF Cloud. If you alter the Destination URL, re-verification is required. See Create a new Destination for more information about verification.
required | Nominal-string-.Uuid.- (string) <uuid> = 36 characters ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3... Examples: a5592ec1-18ae-4d9d-bc44-1d9bd927bbe9 Universally unique identifier |
name | string non-empty |
isEnabled | boolean If |
dlqNotificationEmails | Array of strings (Email) [^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2...] The email address to which DLQ notifications are sent. |
object |
{- "name": "string",
- "isEnabled": true,
- "dlqNotificationEmails": [
- "user@example.com"
], - "config": {
- "type": "http",
- "url": "string",
- "verifySsl": true,
- "secret": "string",
- "token": "string"
}
}
{- "id": "string",
- "createdAt": "string",
- "name": "string",
- "config": {
- "type": "http",
- "url": "string",
- "verifySsl": true
}, - "isEnabled": true,
- "errors": [
- {
- "reason": {
- "message": "Received non 2xx response from webhook destination",
- "response": {
- "status": 404,
- "body": "Not Found"
}
}, - "createdAt": "string",
- "correlationId": "string"
}
], - "dlqSize": 0,
- "dlqNotificationEmails": [
- "user@example.com"
]
}
List the items in the Dead-Letter Queue (DLQ) for a Destination.
required | Nominal-string-.Uuid.- (string) <uuid> = 36 characters ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3... Examples: a5592ec1-18ae-4d9d-bc44-1d9bd927bbe9 Universally unique identifier |
pageLimit | number (PageLimit) Examples:
|
pageNextToken | string (PageToken) [ 1 .. 256 ] characters ^[^\s]{1,256}$ Examples:
Token used to retrieve the next page of items in the list. Present in a response only if the total available results exceeds the specified limit on a page. This token does not change between requests. When supplying as a request parameter, use URL-encoding. |
{- "items": [
- {
- "teamId": "a5592ec1-18ae-4d9d-bc44-1d9bd927bbe9",
- "destinationId": "a5592ec1-18ae-4d9d-bc44-1d9bd927bbe9",
- "deviceId": "string",
- "messageId": "a5592ec1-18ae-4d9d-bc44-1d9bd927bbe9",
- "topic": "string",
- "message": {
- "temperature": 25
}, - "receivedAt": 1616425200000,
- "createdAt": 1616425200000,
- "coapRequestUrl": "string"
}
], - "total": 10,
- "pageNextToken": "4bb1f9ab35bd"
}