User Subscribe
1 min
This API notifies the Pathfix Automation's webhook module to start listening for webhooks for the given user_id.
The API will always return a success message but will only really work if the user_id is connected via Pathfix OAuth and the webhook is in an active state.
User Subscribe API
Call this API to subscribe a user to an active webhook.
POST
https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe
Query Parameters
- user_idstringrequiredDescription
- public_keystringrequiredDescription
- private_keystringrequiredDescription
curl
curl --request GET
--url https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe
-d user_id={{user_id}}
-d public_key={{public_key}}
-d private_key={{private_key}}
--header 'Accept: application/json'nodejs
const fetch = require('node-fetch');
let url = 'https://labs.pathfix.com/api/connection';
let options = {
method: 'GET',
headers: {
Accept: 'application/json',
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));python
import requests
url = "https://labs.pathfix.com/api/connection"
headers = {"Accept": "application/json"}
response = requests.request("GET", url, headers=headers)
print(response.text)ruby
const fetch = require('node-fetch');
let url = 'https://labs.pathfix.com/api/connection';
let options = {method: 'GET', headers: {Accept: 'application/json'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error('error:' + err));nodejs
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string',
'headers': {
'Accept': 'application/json'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));python
import requests
url = "https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string"
payload={}
headers = {
'Accept': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "net/http"
url = URI("https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
response = https.request(request)
puts response.read_body
curl
curl --location -g --request POST 'https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string' \
--header 'Accept: application/json'nodejs
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string',
'headers': {
'Accept': 'application/json'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
javascript
var myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));python
import requests
url = "https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string"
payload={}
headers = {
'Accept': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
ruby
require "uri"
require "net/http"
url = URI("https://labs.pathfix.com/api/webhook/{{provider}}/user_subscribe?user_id=string&public_key=string&private_key=string")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
response = https.request(request)
puts response.read_body
200
{
"rows": [
{
"pincStatus": "success",
"callId": "00dd76ab-f623-48ae-9448-8b3f665ceef5",
"data": "Webhook Subscription Notification sent to Pathfix Automation for user_id: {{user_id}} and provider: {{provider}}"
}
]
}403
Unauthorized