Skip to content

Instantly share code, notes, and snippets.

View IbrahimTareq's full-sized avatar
🎯
Focusing

Ibrahim IbrahimTareq

🎯
Focusing
View GitHub Profile
@IbrahimTareq
IbrahimTareq / deleteKey.js
Created July 22, 2018 11:36
Code snippet on how to delete a signature key using the MessageMedia Signature Key Management Node.js SDK.
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 July 19, 2018 01:40
Code snippet on how to get a list of all signature keys using the MessageMedia Signature Key Management Node.js SDK.
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 July 19, 2018 01:03
Code snippet on how to get the current enabled key using the MessageMedia Signature Key Management Node.js SDK.
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 July 19, 2018 00:59
Code snippet on how to disable a key using the MessageMedia Signature Key Management Node.js SDK.
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 July 19, 2018 00:55
Code snippet on how to enable a key using the MessageMedia Signature Key Management Node.js SDK.
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 July 18, 2018 05:26
Code snippet on how to create a pair of keys using the MessageMedia Signature Key Management Node.js SDK.
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 June 17, 2018 23:24
Code snippet on how to send message to a user with your Facebook page using the MessageMedia Conversations Node.js SDK.
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 June 17, 2018 23:23
Code snippet on how to retrieve all messages associated with a user using the MessageMedia Conversations Node.js SDK.
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 June 17, 2018 23:22
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.
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 June 17, 2018 23:22
Code snippet on how to retrieve all users associated with your Facebook page using the MessageMedia Conversations Node.js SDK.
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);