const axios = require('axios');
const WebhooksApiFp = require('@alohi/faxplus-api').WebhooksApiFp;
const Configuration = require('@alohi/faxplus-api').Configuration;
const config = new Configuration({
accessToken: accessToken,
basePath: 'https://restapi.fax.plus/v3',
// Header required only when using the OAuth2 token scheme
baseOptions: {
headers: {
"x-fax-clientid": clientId,
}
}
});
async function createWebhook() {
const reqParams = {
"webhook": {
"target": "http://myapp.com/fax_received",
"event": "fax_received"
}
}
const req = await WebhooksApiFp(config).createWebhook(reqParams);
const resp = await req(axios);
}
createWebhook()
from faxplus import ApiClient, WebhooksApi, Webhook
from faxplus.configuration import Configuration
webhook = Webhook(target='http://myapp.com/fax_received', event='fax_received')
conf = Configuration()
conf.access_token = access_token
# header_name and header_value required only when using the OAuth2 token scheme
api_client = ApiClient(header_name='x-fax-clientid', header_value=client_id, configuration=conf)
api = WebhooksApi(api_client)
resp = api.create_webhook(body=webhook)
/**
* Example below uses Apache HTTP Client 4 with Fluent API
**/
String url = "https://restapi.fax.plus/v3/hooks";
String jsonBody = ...; // See request body example
String result = Request
.Post(url)
// The x-fax-clientid header is required only when using the OAuth2 token scheme
.addHeader("x-fax-clientid", "YOUR_CLIENT_ID")
.addHeader("Content-Type", "'application/json'")
.addHeader("Accept", "'application/json'")
.addHeader("Authorization", "'Bearer {access-token}'")
.bodyString(jsonBody, "application/json")
.execute()
.returnContent().asString();
System.out.println(result.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
// The x-fax-clientid header is required only when using the OAuth2 token scheme
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
"x-fax-clientid": []string{"YOUR_CLIENT_ID"}
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://restapi.fax.plus/v3/hooks", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
// The x-fax-clientid header is required only when using the OAuth2 token scheme
'x-fax-clientid' => '{client ID}',
);
$client = new GuzzleHttp\Client();
// Define array of request body.
$request_body = ...; // See request body example
try {
$response = $client->request('POST','https://restapi.fax.plus/v3/hooks', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
# You can also use wget
curl -X POST https://restapi.fax.plus/v3/hooks \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
# The x-fax-clientid header is required only when using the OAuth2 token scheme
-H 'x-fax-clientid: "YOUR CLIENT_ID"'
{
"id": "6048b47181dbe1a7d67fcc98"
}{
"error": "invalid_user_id",
"description": "Invalid user id given"
}{
"error": "internal_server_error",
"description": "An unexpected error happened, please contact support"
}Webhooks
Register new webhook
Register a new webhook which will be called on a specific event. See the WebhookCallback model. (Permitted scopes: fax:all:edit, fax:webhook:edit)
POST
/
hooks
const axios = require('axios');
const WebhooksApiFp = require('@alohi/faxplus-api').WebhooksApiFp;
const Configuration = require('@alohi/faxplus-api').Configuration;
const config = new Configuration({
accessToken: accessToken,
basePath: 'https://restapi.fax.plus/v3',
// Header required only when using the OAuth2 token scheme
baseOptions: {
headers: {
"x-fax-clientid": clientId,
}
}
});
async function createWebhook() {
const reqParams = {
"webhook": {
"target": "http://myapp.com/fax_received",
"event": "fax_received"
}
}
const req = await WebhooksApiFp(config).createWebhook(reqParams);
const resp = await req(axios);
}
createWebhook()
from faxplus import ApiClient, WebhooksApi, Webhook
from faxplus.configuration import Configuration
webhook = Webhook(target='http://myapp.com/fax_received', event='fax_received')
conf = Configuration()
conf.access_token = access_token
# header_name and header_value required only when using the OAuth2 token scheme
api_client = ApiClient(header_name='x-fax-clientid', header_value=client_id, configuration=conf)
api = WebhooksApi(api_client)
resp = api.create_webhook(body=webhook)
/**
* Example below uses Apache HTTP Client 4 with Fluent API
**/
String url = "https://restapi.fax.plus/v3/hooks";
String jsonBody = ...; // See request body example
String result = Request
.Post(url)
// The x-fax-clientid header is required only when using the OAuth2 token scheme
.addHeader("x-fax-clientid", "YOUR_CLIENT_ID")
.addHeader("Content-Type", "'application/json'")
.addHeader("Accept", "'application/json'")
.addHeader("Authorization", "'Bearer {access-token}'")
.bodyString(jsonBody, "application/json")
.execute()
.returnContent().asString();
System.out.println(result.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
// The x-fax-clientid header is required only when using the OAuth2 token scheme
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
"x-fax-clientid": []string{"YOUR_CLIENT_ID"}
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://restapi.fax.plus/v3/hooks", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
// The x-fax-clientid header is required only when using the OAuth2 token scheme
'x-fax-clientid' => '{client ID}',
);
$client = new GuzzleHttp\Client();
// Define array of request body.
$request_body = ...; // See request body example
try {
$response = $client->request('POST','https://restapi.fax.plus/v3/hooks', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
# You can also use wget
curl -X POST https://restapi.fax.plus/v3/hooks \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
# The x-fax-clientid header is required only when using the OAuth2 token scheme
-H 'x-fax-clientid: "YOUR CLIENT_ID"'
{
"id": "6048b47181dbe1a7d67fcc98"
}{
"error": "invalid_user_id",
"description": "Invalid user id given"
}{
"error": "internal_server_error",
"description": "An unexpected error happened, please contact support"
}const axios = require('axios');
const WebhooksApiFp = require('@alohi/faxplus-api').WebhooksApiFp;
const Configuration = require('@alohi/faxplus-api').Configuration;
const config = new Configuration({
accessToken: accessToken,
basePath: 'https://restapi.fax.plus/v3',
// Header required only when using the OAuth2 token scheme
baseOptions: {
headers: {
"x-fax-clientid": clientId,
}
}
});
async function createWebhook() {
const reqParams = {
"webhook": {
"target": "http://myapp.com/fax_received",
"event": "fax_received"
}
}
const req = await WebhooksApiFp(config).createWebhook(reqParams);
const resp = await req(axios);
}
createWebhook()
from faxplus import ApiClient, WebhooksApi, Webhook
from faxplus.configuration import Configuration
webhook = Webhook(target='http://myapp.com/fax_received', event='fax_received')
conf = Configuration()
conf.access_token = access_token
# header_name and header_value required only when using the OAuth2 token scheme
api_client = ApiClient(header_name='x-fax-clientid', header_value=client_id, configuration=conf)
api = WebhooksApi(api_client)
resp = api.create_webhook(body=webhook)
/**
* Example below uses Apache HTTP Client 4 with Fluent API
**/
String url = "https://restapi.fax.plus/v3/hooks";
String jsonBody = ...; // See request body example
String result = Request
.Post(url)
// The x-fax-clientid header is required only when using the OAuth2 token scheme
.addHeader("x-fax-clientid", "YOUR_CLIENT_ID")
.addHeader("Content-Type", "'application/json'")
.addHeader("Accept", "'application/json'")
.addHeader("Authorization", "'Bearer {access-token}'")
.bodyString(jsonBody, "application/json")
.execute()
.returnContent().asString();
System.out.println(result.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
// The x-fax-clientid header is required only when using the OAuth2 token scheme
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
"x-fax-clientid": []string{"YOUR_CLIENT_ID"}
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://restapi.fax.plus/v3/hooks", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
// The x-fax-clientid header is required only when using the OAuth2 token scheme
'x-fax-clientid' => '{client ID}',
);
$client = new GuzzleHttp\Client();
// Define array of request body.
$request_body = ...; // See request body example
try {
$response = $client->request('POST','https://restapi.fax.plus/v3/hooks', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
# You can also use wget
curl -X POST https://restapi.fax.plus/v3/hooks \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}' \
# The x-fax-clientid header is required only when using the OAuth2 token scheme
-H 'x-fax-clientid: "YOUR CLIENT_ID"'
Authorizations
oauth2personal_access_token
OAuth2 Authorization Grant
Body
application/json
Request to create new webhook
Webhook model
Webhook target URL
Webhook event type
Available options:
fax_received, fax_sent, fax_page_received Webhook ID
A list of phone numbers used to filter webhook triggers. If specified, the webhook will only fire for inbound or outbound calls involving these numbers. Pass null to disable filtering. An empty array is invalid
Minimum array length:
1Required string length:
2 - 16Pattern:
^[+][1-9][0-9]{1,14}$Example:
["+12135550123"]
Response
Webhook ID
Webhook ID
Webhook ID
⌘I