Skip to content

Instantly share code, notes, and snippets.

@comalex
Created September 20, 2019 12:31
Show Gist options
  • Save comalex/566c0371529ce7058a7782c38a0d78e8 to your computer and use it in GitHub Desktop.
Save comalex/566c0371529ce7058a7782c38a0d78e8 to your computer and use it in GitHub Desktop.
Webhook example
var request = require("request");
var options = { method: 'POST',
url: 'https://bot1.nmodes.com/bot/api/v1/webhook',
headers:
{
Authorization: 'Bearer YOURTOKEN',
'Content-Type': 'application/json' },
body:
{ user:
{ id: 1,
first_name: 'John',
last_name: 'Chung',
address: 'Baker Street, London, NW1 6XE' },
responseId: '312f4-094f4-12ddf',
queryTask:
[ { task: 'maintenance issue',
id: 123,
status: 'sync',
response: 'null',
details:
{ activity: 'bathroom repair',
location: 'room #105 floor: 49',
id: '123',
'activity spec': 'leak in the toilet',
status: 'toilet not usable.',
response: 'water turned off' },
remedy: null } ] },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment