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.
| 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": [
- {
- "id": "f7de2039-06bd-4da5-b493-7ed0a038ccf3",
- "name": "Test Destination 01",
- "isEnabled": true,
- "errors": [ ],
- "dlqSize": 0,
- "dlqNotificationEmails": [
- "user@example.com"
], - "createdAt": "2024-09-19 00:00:17.867+00",
- "verified": false
}
], - "total": 1,
- "pageNextToken": "def456"
}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 (WritableHttpConfiguration) |
| isEnabled required | boolean If |
| dlqNotificationEmails required | 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": "Test Destination 01",
- "config": {
- "type": "http",
- "verifySsl": false
}, - "dlqNotificationEmails": [
- "user@example.com"
], - "isEnabled": true
}{- "id": "f7de2039-06bd-4da5-b493-7ed0a038ccf3",
- "name": "Test Destination 01",
- "isEnabled": true,
- "errors": [ ],
- "dlqSize": 0,
- "dlqNotificationEmails": [
- "user@example.com"
], - "createdAt": "2024-09-19 00:00:17.867+00",
- "verified": false
}Sends a message to your Destination for testing purposes.
required | NominalStringUuid (string) <uuid> = 36 characters ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3... Examples:
Universally unique identifier |
null{- "destinationResponse": {
- "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 | NominalStringUuid (string) <uuid> (Uuid) = 36 characters ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3... Examples:
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": "Test Destination 02",
- "dlqNotificationEmails": [
- "user@example.com"
], - "isEnabled": true
}Sends a Verification token to the Destination. For HTTP Destinations, Message Routing Service sends the verification token via POST request to your configured url. Here is an example of the payload that will be sent to the destination:
{
"type": "system.verification",
"messages": [{ "verificationToken": "012345"}],
"timestamp": "2024-10-03T22:37:56.936Z"
}
This token can then be used to verify the destination using the verification endpoint
required | NominalStringUuid (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 |
Verify the Destination. Successful verifications will mark the destination as verified and will allow Message Routing Service to start sending messages to the destination. For HTTP Destinations, Message Routing Service sends the verification token via POST request to your configured url. This occur when you create the destination or update the url of the destination. You can also resend a verification tokens using the send verification endpoint.
required | NominalStringUuid (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 |
| verificationToken required | string^\d{6}$ The verification token used to verify the destination. This should match the numeric token sent to the destination url via POST. |
{- "verificationToken": "012345"
}List the items in the Dead-Letter Queue (DLQ) for a Destination.
required | NominalStringUuid (string) <uuid> = 36 characters ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3... Examples:
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": [
- {
- "createdAt": 1728087037849,
- "destinationId": "f7de2039-06bd-4da5-b493-7ed0a038ccf3",
- "deviceId": "account-d2bcde5f-9abc-41ec-a1aa-ee1c114b42b7",
- "message": "{\"messageType\":\"DATA\",\"appId\":\"TEMP\",\"data\":\"20.84\",\"ts\":\"1726704015040\"}",
- "messageId": "57bcc708-ea0d-46c4-9d52-8cea98fb3213",
- "receivedAt": 1728087037849,
- "teamId": "cdd6dab7-a549-4988-960a-5cbf29caf646",
- "topic": "prod/cdd6dab7-a549-4988-960a-5cbf29caf646/m/d/account-d2bcde5f-9abc-41ec-a1aa-ee1c114b42b7/d2c"
}
], - "total": 1,
- "pageNextToken": "def456"
}