Last active
May 29, 2018 09:55
-
-
Save antstanley/54ba95e8761cde5d760ea216ba267f6c to your computer and use it in GitHub Desktop.
example to publish event to Azure Event Grid using Request module and Azure REST interface
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 request = require('request'); | |
function publishEvent(topicURL, topicSecret, eventPayload, callback) { | |
const options = { | |
method: 'POST', | |
url: topicURL, | |
headers: { | |
'aeg-sas-key': topicSecret | |
}, | |
json: true, | |
body: [eventPayload] | |
} | |
request(options, (err, response, body) => { | |
if (err) { | |
callback(err) | |
} else { | |
callback(null, true); | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment