This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.FacebookController; | |
var facebookPageId = 'facebookPageId'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.FacebookController; | |
controller.getFacebookPages(function(error, response, context) { | |
console.log(response); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.ConfigurationController; | |
var request = new lib.ConfigureAccountRequest({ | |
"name": "Rainbow Serpent Festival", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createWebhook(){ | |
var controller = setup(); | |
// Create body of your webhook | |
var body = new lib.CreateWebhookRequest({ | |
"url": "http://webhook.com", // URL of the webhook | |
"method": "POST", // HTTP method | |
"encoding": "JSON", // Content type of the request | |
"events": [ | |
"RECEIVED_SMS" // Webhook subscribed to RECEIVED_SMS event which is triggered when an SMS is received |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lib = require('messagemedia-webhooks-sdk'); | |
// Sets your auth credentials and creates controller which is used to call the createWebhook function from the SDK | |
function setup(){ | |
var controller; | |
// Configuration parameters and credentials | |
lib.Configuration.basicAuthUserName = "API_KEY"; | |
lib.Configuration.basicAuthPassword = "API_SECRET"; | |
controller = lib.WebhooksController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteWebhook(){ | |
var controller = setup(); | |
// The id of the webhook that you would like to delete | |
var webhookId = "WEBHOOK_ID"; | |
// Call the function that deletes the webhook | |
controller.deleteWebhook(webhookId, function(error, response, context) { | |
console.log(response); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateWebhook(){ | |
var webhookId = "WEBHOOK_ID"; | |
var body = new lib.UpdateWebhookRequest({ | |
"url": "https://myurl.com", | |
"method": "GET", | |
"encoding": "FORM_ENCODED", | |
"events": [ | |
"RECEIVED_SMS" | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function retrieveWebhook(){ | |
var controller = setup(); | |
var page = 0; | |
var pageSize = 0; | |
controller.retrieveWebhook(page, pageSize, function(error, response, context) { | |
console.log(response); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const lib = require('messagemedia-webhooks-sdk'); | |
// Sets your auth credentials and creates controller which is used to call the createWebhook function from the SDK | |
function setup(){ | |
var controller; | |
// Configuration parameters and credentials | |
lib.Configuration.basicAuthUserName = "API_KEY"; | |
lib.Configuration.basicAuthPassword = "API_SECRET"; | |
controller = lib.WebhooksController; |