Description
Processes an incoming webhook for a specific entry that is on an Incoming Webhook step.
Authentication
For available methods to authenticate to the API, refer to our REST API v2 Authentication guide.
By default the permissions are checked based on API key/secret values from the step settings as well as associated entry ID and step status to confirm a valid request status. This can be adjusted using the gravityflowincomingwebhook_check_permissions filter.
Using the Endpoint
Path and Method
POST /wp-json/gf/v2/entries/[entry_id]/workflow-hooks
Request Parameters
| Key | Type | Location | Required | Description |
|---|---|---|---|---|
| entry_id | integer | Path | Required | The ID of the entry |
| workflow-api-key | string | Query | Required | API key configured in the step |
| workflow-api-secret | string | Query | Required | API secret configured in the step |
| [custom] | Webhook specific | Body | Optional | The specific parameters depend on the field mappings configured for the webhook |
Response
Success
| Response Code | Message |
|---|---|
| 200 | complete |
Failure
A failed response will provide a JSON string of the error code and message.
| Key | Type | Description |
|---|---|---|
| code | string | Error code. |
| message | string | Human-readable error message. |
| data[status] | integer | HTTP response status code |
There are several failure scenarios which could be returned depending on request data provided.
| Response Code and data[status] | Error Code | Message | Details |
|---|---|---|---|
| 401 / 403 | permission_denied | Sorry, you are not allowed to do that. | User does not have the required permissions for this endpoint. |
Usage
PHP Request
<?php
//Replace these variables with values relevant to your site.
$website_url = 'https://example.com/';
$entry_id = 123;
$api_key = string;
$api_secret = string;
$response = wp_remote_post( ' . $website_url . $api_key . $api_secret, array(
'headers' => array(
'Content-Type' => 'application/json; charset=utf-8',
),
'body' => $json,
) );
if ( ! is_wp_error( $response ) ) {
// The request went through successfully, check the response code against
// what we're expecting
if ( 200 == wp_remote_retrieve_response_code( $response ) ) {
// Do something with the response
// $body = wp_remote_retrieve_body( $response );
// $headers = wp_remote_retrieve_headers( $response );
} else {
// The response code was not what we were expecting, record the message
$error_message = wp_remote_retrieve_response_message( $response );
}
} else {
// There was an error making the request
$error_message = $response->get_error_message();
}
API Response
complete
Since
This endpoint was added in Gravity Flow Incoming Webhook 1.3.1
Source Code
This endpoint is located in the gravityflowincomingwebhook/includes/class-step-incoming-webhook.php file.