messagemedia-signingkeys-sdk v1.2.0
MessageMedia Signature Key Management NodeJS SDK
The MessageMedia Signature Key API provides a number of endpoints for managing key used to sign each unique request to ensure security and the requests can't (easily) be spoofed. This is similar to using HMAC in your outbound messaging (rather than HTTP Basic).
⭐️ Installing via NPM
Now install messagemedia-messages-sdk via npm by using:
npm install messagemedia-signingkeys-sdk
Alternatively, add the following to the dependencies section of your package.json:
"messagemedia-signingkeys-sdk": "^1.2.0"
🎬 Get Started
It's easy to get started. Simply enter the API Key and secret you obtained from the MessageMedia Developers Portal into the code snippet below.
🚀 Create a signature key
const lib = require('messagemedia-signingkeys-sdk');
// Configuration parameters and credentials
lib.Configuration.basicAuthUserName = "API_KEY"; // The username to use with basic authentication
lib.Configuration.basicAuthPassword = "API_SECRET"; // The password to use with basic authentication
var controller = lib.SignatureKeyManagementController;
var body = new lib.CreateSignatureKeyRequest({
"digest": "SHA224",
"cipher": "RSA"
});
controller.createSignatureKey(body, function(error, response, context) {
console.log(response);
});
📥 Get signature key details
You can get a key_id by looking at the id of the signature key created from the response of the above example.
const lib = require('messagemedia-signingkeys-sdk');
// Configuration parameters and credentials
lib.Configuration.basicAuthUserName = "API_KEY"; // The username to use with basic authentication
lib.Configuration.basicAuthPassword = "API_SECRET"; // The password to use with basic authentication
var controller = lib.SignatureKeyManagementController;
var keyId = "7ca628a8-08b0-4e42-aeb8-960b37049c31";
controller.getSignatureKeyDetail(keyId, function(error, response, context) {
console.log(response);
});
📥 Get signature keys list
const lib = require('messagemedia-signingkeys-sdk');
// Configuration parameters and credentials
lib.Configuration.basicAuthUserName = "API_KEY"; // The username to use with basic authentication
lib.Configuration.basicAuthPassword = "API_SECRET"; // The password to use with basic authentication
var controller = lib.SignatureKeyManagementController;
controller.getSignatureKeyList(function(error, response, context) {
console.log(response);
});
❌ Delete signature key
You can get the key_id by looking at the ids of the signature keys returned from the response of the Get signature keys list
example.
const lib = require('messagemedia-signingkeys-sdk');
// Configuration parameters and credentials
lib.Configuration.basicAuthUserName = "API_KEY"; // The username to use with basic authentication
lib.Configuration.basicAuthPassword = "API_SECRET"; // The password to use with basic authentication
var controller = lib.SignatureKeyManagementController;
var keyId = "7ca628a8-08b0-4e42-aeb8-960b37049c31";
controller.deleteSignatureKey(keyId, function(error, response, context) {
console.log(response);
});
☑️ Enable a signature key
You can get the key_id by looking at the ids of the signature keys returned from the response of the Get signature keys list
example.
const lib = require('messagemedia-signingkeys-sdk');
// Configuration parameters and credentials
lib.Configuration.basicAuthUserName = "API_KEY"; // The username to use with basic authentication
lib.Configuration.basicAuthPassword = "API_SECRET"; // The password to use with basic authentication
var controller = lib.SignatureKeyManagementController;
var body = new lib.EnableSignatureKeyRequest({
"key_id": "7ca628a8-08b0-4e42-aeb8-960b37049c31"
});
controller.updateEnableSignatureKey(body, function(error, response, context) {
console.log(response);
});
📥 Get enabled signature key
const lib = require('messagemedia-signingkeys-sdk');
// Configuration parameters and credentials
lib.Configuration.basicAuthUserName = "API_KEY"; // The username to use with basic authentication
lib.Configuration.basicAuthPassword = "API_SECRET"; // The password to use with basic authentication
var controller = lib.SignatureKeyManagementController;
controller.getEnabledSignatureKey(function(error, response, context) {
console.log(response);
});
🚫 Disable an enabled signature key
const lib = require('messagemedia-signingkeys-sdk');
// Configuration parameters and credentials
lib.Configuration.basicAuthUserName = "API_KEY"; // The username to use with basic authentication
lib.Configuration.basicAuthPassword = "API_SECRET"; // The password to use with basic authentication
var controller = lib.SignatureKeyManagementController;
controller.deleteDisableTheCurrentEnabledSignatureKey(function(error, response, context) {
console.log(response);
});
📕 API Reference Documentation
Check out the full API documentation for more detailed information.
😕 Need help?
Please contact developer support at developers@messagemedia.com or check out the developer portal at developers.messagemedia.com
📃 License
Apache License. See the LICENSE file.