Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ibrahim IbrahimTareq

🎯
Focusing
View GitHub Profile
@IbrahimTareq
IbrahimTareq / deleteKey.js
Created Jul 22, 2018
Code snippet on how to delete a signature key using the MessageMedia Signature Key Management Node.js SDK.
View deleteKey.js
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";
@IbrahimTareq
IbrahimTareq / getKeyList.js
Created Jul 19, 2018
Code snippet on how to get a list of all signature keys using the MessageMedia Signature Key Management Node.js SDK.
View getKeyList.js
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);
@IbrahimTareq
IbrahimTareq / getEnabledKey.js
Created Jul 19, 2018
Code snippet on how to get the current enabled key using the MessageMedia Signature Key Management Node.js SDK.
View getEnabledKey.js
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);
@IbrahimTareq
IbrahimTareq / disable.js
Created Jul 19, 2018
Code snippet on how to disable a key using the MessageMedia Signature Key Management Node.js SDK.
View disable.js
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);
@IbrahimTareq
IbrahimTareq / enable.js
Created Jul 19, 2018
Code snippet on how to enable a key using the MessageMedia Signature Key Management Node.js SDK.
View enable.js
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" // Example of what a key_id could look like
@IbrahimTareq
IbrahimTareq / createKeys.js
Created Jul 18, 2018
Code snippet on how to create a pair of keys using the MessageMedia Signature Key Management Node.js SDK.
View createKeys.js
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;
// The body of the request
var body = new lib.CreateSignatureKeyRequest({
@IbrahimTareq
IbrahimTareq / sendMessage.js
Created Jun 17, 2018
Code snippet on how to send message to a user with your Facebook page using the MessageMedia Conversations Node.js SDK.
View sendMessage.js
const lib = require('messagemedia-conversations-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.AppUsersController;
var appUserId = 'appUserId';
var message = new BaseMessageDto({"key":"value"});
@IbrahimTareq
IbrahimTareq / getUserMessages.js
Created Jun 17, 2018
Code snippet on how to retrieve all messages associated with a user using the MessageMedia Conversations Node.js SDK.
View getUserMessages.js
const lib = require('messagemedia-conversations-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.AppUsersController;
var appUserId = 'appUserId';
@IbrahimTareq
IbrahimTareq / getUserById.js
Created Jun 17, 2018
Code snippet on how to retrieve a user based on id who is associated with your Facebook page using the MessageMedia Conversations Node.js SDK.
View getUserById.js
const lib = require('messagemedia-conversations-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.AppUsersController;
var appUserId = 'appUserId';
@IbrahimTareq
IbrahimTareq / getUsers.js
Created Jun 17, 2018
Code snippet on how to retrieve all users associated with your Facebook page using the MessageMedia Conversations Node.js SDK.
View getUsers.js
const lib = require('messagemedia-conversations-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.AppUsersController;
controller.getAppUsers(function(error, response, context) {
console.log(response);
You can’t perform that action at this time.