Last active
April 20, 2019 09:27
-
-
Save mrlynn/e98216485b650a9dce06a8cbd1828a06 to your computer and use it in GitHub Desktop.
MongoDB Stitch Function to Lookup a number using Twilio's lookup API
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
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