Skip to Content
Pipelines Hooks

Create a hook to a specific pipeline

POST
/pipelines/{pipeline_id}/hooks/{hook_type}

Path Parameters

hook_type*string

The type of the hook.

Value in"incoming""outgoing"
pipeline_id*integer

The ID of the pipeline that will be executed by the created action

Range1 <= value

Header Parameters

Accept*string

application/json

Authorization*string

Bearer {{access_token}}

Content-Type*string

application/json

Request Body

A JSON object containing the resource data

application/json
  1. body
name*string

The name of the outgoing hook. Must not be greater than 60 characters.

active?boolean

Determines if the hook is currently active.

requires_secret?boolean

Tells if requests to this hook must only be accepted when a HTTP header is sent with a message authentication code (HMAC) generated based on the secret provided by Devopness and shared by user with external sources. This field is required when type is in.

secret_algorithm?string

The cryptographic hash function to be used by Devopness when validating digitally signed incoming requests for hooks that require secret validation. This field is required when requires_secret is true. Must not be greater than 20 characters.

secret_header_name?string

The name of the HTTP request header from which the request digital signature should be extracted. This field is required when requires_secret is true. Must not be greater than 64 characters.

secret?string

The signing secret used to validate incoming hooks. Either omit this field and let Devopness generate one, or provide the signing secret created by your external provider so Devopness can validate its deliveries. Must not be greater than 255 characters.

secret_signature_has_algorithm_prefix?boolean

Whether the signature header value includes the algorithm prefix, for example sha256=<hex>. When false, the header must contain only the raw hex HMAC. This field is required when requires_secret is true.

trigger_when?
settings?|

Response Body

Created

application/json
  1. response
id*string

The UUID of the given hook

name*string

The name entered by the user (or auto-generated by Devopness) to uniquely identify the hook

type*HookType

The type of hook (incoming or outgoing)

Value in"in""out"
action_type*ActionType
Value in"check_provisioned""configure""delete""deploy""get_status""provision""reload""remove""restart""rotate_key""start""stop"
url*|

URL that triggers incoming hooks

target_url*|

URL that outgoing hooks make a request to

is_auto_generated*boolean

Indicates if the record was auto_generated by Devopness itself

requires_secret*boolean

Tells if requests to this hook must only be accepted when a HTTP header is sent with a message authentication code (HMAC) generated based on the secret provided by Devopness and shared by user with external sources

verify_ssl*boolean

Indicates if the Devopness must be verify the SSL certificate of the request

active*boolean

Determines if the hook is currently active

project_id*integer

The ID of the project

environment_id*integer

The ID of the environment

pipeline_id*|

The ID of the pipeline executed by this hook

resource_type*ResourceType

Type of an infrastructure resource managed through a Devopness environment.

Value in"application""credential""cronjob""daemon""deployment""network""network-rule""server""service""ssh-key""ssl-certificate""subnet""virtual-host"
resource_id*integer

The hooks' resource ID

settings*|
trigger_when*
secret*string

The signing secret for incoming hooks. Devopness generates one when the caller omits it; a caller-supplied secret is returned as-is. The clear value is returned only once, in the create response, and cannot be retrieved again after that.

secret_algorithm*|

The cryptographic hash function to be used by Devopness when validating digitally signed incoming requests for hooks that require secret validation

secret_header_name*|

The name of the HTTP request header from which the request digital signature should be extracted

secret_signature_has_algorithm_prefix*|

Whether the signature header value includes the algorithm prefix, for example sha256=<hex>. When false, the header contains only the raw hex HMAC.

created_by_user*|null
created_at*string

The date and time when the record was created

updated_at*string

The date and time when the record was last updated

Example Request
curl -X POST 'https://api.devopness.com/pipelines/123/hooks/incoming' \  -H 'Accept: application/json' \  -H 'Authorization: Bearer <your_api_token>' \  -H 'Content-Type: application/json' \  -H 'Content-Type: application/json' \  -d '{  "name": "lets-go-fishing"}'
Example Response
{  "id": "f1a61a4e-4d08-11eb-9481-0242ac130004",  "name": "my-app deploy",  "type": "in",  "action_type": "deploy",  "url": "http://localhost/hooks/incoming/0a2f9b84-e9bb-4fef-b146-51847bb9e569",  "target_url": "https://fake-url-test.com/hook/12345",  "is_auto_generated": false,  "requires_secret": true,  "verify_ssl": true,  "active": true,  "project_id": 34985723,  "environment_id": 579085,  "pipeline_id": 289542,  "resource_type": "application",  "resource_id": 9056412,  "settings": {    "variables": [      {        "name": "environment_id",        "path": "data.environment.id",        "type": "integer",        "required": false,        "default_value": null      }    ]  },  "trigger_when": {    "events": [      "action.status_changed",      "action.queued",      "action.started",      "action.completed",      "action.failed"    ],    "conditions": [      {        "name": "Only trigger incoming hook on PRs of a given pull request author",        "type": "request_body",        "path": "sender.login",        "accepted_values": [          "some-one"        ]      }    ]  },  "secret": "*****",  "secret_algorithm": "sha256",  "secret_header_name": "X-Custom-Header",  "secret_signature_has_algorithm_prefix": true,  "created_by_user": {    "id": 1,    "name": "string",    "email": "user@example.com",    "url_slug": "someone",    "language": "en",    "active": true,    "created_at": "2019-09-25T15:50:48.000000Z",    "updated_at": "2019-09-25T13:52:04.000000Z"  },  "created_at": "2022-09-26T15:30:31.000000Z",  "updated_at": "2022-09-26T15:30:58.000000Z"}