Skip to content

Instantly share code, notes, and snippets.

@mrlynn
Last active April 20, 2019 09:27
Show Gist options
  • Save mrlynn/e98216485b650a9dce06a8cbd1828a06 to your computer and use it in GitHub Desktop.
Save mrlynn/e98216485b650a9dce06a8cbd1828a06 to your computer and use it in GitHub Desktop.
MongoDB Stitch Function to Lookup a number using Twilio's lookup API
exports = function(phoneNumber){
const host = "lookups.twilio.com";
const path = `/v1/PhoneNumbers/${phoneNumber}`;
const lookupUrl = `https://lookups.twilio.com/v1/PhoneNumbers/${phoneNumber}`;
const http = context.services.get("http");
const { SID, Secret } = context.values.get("twilioCredentials");
return http.get({
"scheme": "https",
host,
path,
"username": SID,
"password": Secret
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment