Skip to main content
Question

Cannot access tokens to integrate webhook in developer sandbox account

  • 25 April 2020
  • 1 reply
  • 343 views

I am trying to integrate glip webhook in my SharePoint online/office 365 modern page,I have developer/sandbox account and created sandbox app.trying to post messages via a glip webhook.How i can access token to call/use API??

You don't need an access token to post a Glip webhook message. However, if you don't know your Glip Webhook address and want to detect it programmatically, then you can login your app and call the glip/webhooks endpoint to get a list of webhooks addresses.

To post a message to a Glip Webhook, read this blog for details on how to set it up and use any http POST request to send.

Here is some snippet code to post a message in Node JS, provided that you have the webhook_url

function post_message_to_group(){
webhook_url = "https://hooks-glip.devtest.ringcentral.com/webhook/v2/f4baa67a-xx"
var https = require('https');
var url = webhook_url.replace("https://", "")
var urlArr = url.split("/")
var host = urlArr[0]
var path = url.replace(host, "")
var body = {
"icon": "http://tinyurl.com/pn46fgp",
"activity": "Beer consumed",
"title": "Let's stop working and go to WaterDog to have a bear.",
"body": "This is the body of the post"
}
var post_options = {
host: host,
path: path,
method: "POST",
headers: {
'Content-Type': 'application/json'
}
}
var post_req = https.request(post_options, function(res) {
var response = ""
res.on('data', function (chunk) {
response += chunk
});
res.on("end", function(){
console.log(response)
});
});
post_req.write(JSON.stringify(body));
post_req.end();
}

Reply