Manage Workflow Notifications

Prev Next

1. Create Workflow Notification

This POST method creates a workflow notification with the rules and members.

Note: To execute this API, the user should have permission assigned (through policy) with action as workflows.notification.manage.

POST

{{url}}/api/notifications

Request Example 

curl --location --globoff '{{url}}/api/notifications' \
-h 'Content-Type: application/json' \
-h 'Authorization: {{auth}}' \
-d '{
    "name": "Y-Testing",
    "description": "",
    "status": "Active",
    "sendNoChanges": false,
    "actionType": "Email",
    "notificationMedium": [
        {
            "id": ""
        },
        {
            "id": "",
            "channels": [
                "testchannel22",
                "testchannel3"
            ]
        },
        {
            "id": ""
        }
    ],
    "rules": [
        {
            "predicate": "ProfileAccessRequestAllApprovedAndFulfilled",
            "operator": "OR",
            "description": "Access builder request approved and fulfilled"
        }
    ],
    "memberRules": [
        {
            "id": "v0akzyxj5aiodocoya2x",
            "memberType": "User"
        },
        {
            "id": "afl7qbomi9zwcneywqkt",
            "memberType": "User"
        }
    ]
}'

Response Example

Status: 200 Ok

{
    "notificationId" : "vhsg3vitg5z1dieivav0"    
    "name": "Y-Testing",
    "description": "",
    "status": "Active",
    "sendNoChanges": false,
    "actionType": "Email",
    "notificationMedium": [
        {
            "id": ""
        },
        {
            "id": "",
            "channels": [
                "testchannel22",
                "testchannel3"
            ]
        },
        {
            "id": ""
        }
    ],
    "rules": [
        {
            "predicate": "ProfileAccessRequestAllApprovedAndFulfilled",
            "operator": "OR",
            "description": "Access builder request approved and fulfilled"
        }
    ],
    "memberRules": [
        {
            "id": "v0akzyxj5aiodocoya2x",
            "memberType": "User"
        },
        {
            "id": "afl7qbomi9zwcneywqkt",
            "memberType": "User"
        }
    ]
}

2. Update a Workflow Notification

This PUT method updates the workflow notification details.

Note: To execute this API, the user should have permission assigned (through policy) with action as workflows.notification.manage.

PUT

{{url}}/api/notifications

Request Example 

curl --location --globoff --request PUT '{{url}}/api/notifications' \
-h 'Content-Type: application/json' \
-h Authorization: {{auth}}' \
-d '{
    "notificationId": "",
    "name": "ReqFullFilled_h_s",
    "description": "Created Through Automation",
    "status": "Active",
    "sendNoChanges": false,
    "notificationMedium": [
        "{{slackMedium}}",
        "{{medium1}}",
        "{{teamsMedium}}"
    ],
    "actionType": "Email",
    "rules": [
        {
            "predicate": "ProfileAccessRequestAllApprovedAndFulfilled",
            "operator": "OR",
            "description": "Access builder request approved and fulfilled"
        }
    ],
    "recipientUsers": [
        {
            "userId": "{{user1}}"
        },
        {
            "userId": "{{user2}}"
        },
        {
            "userId": "{{user3}}"
        }        
    ],
    "recipientUserTags": [],
    "applications": []
}'

 Response Example 

Status: 200 OK

3. Get All Notifications

This GET method returns a list of all workflow notifications.

Note: To execute this API, the user should have permission assigned (through policy) with action as workflows.notification.view.

GET

{{url}}/api/notifications

Request Example 

curl --location --globoff '{{url}}/api/notifications' \
-h 'Authorization: {{auth}}' \
-d ''

Response Example 

Status: 200 Ok

Shell

[ {
  "notificationId" : "04LOs0X42OOsJ215K2ZX",
  "name" : "1956570960980852676.owasp.org",
  "description" : "",
  "actionType" : null,
  "status" : "Inactive"
}, {
  "notificationId" : "07QeRukKpYvkr4BQHeF1",
  "name" : "JohnTuckerBvsiuautotesYCg",
  "description" : "JohnTuckerBvsiuautotesYCg",
  "actionType" : "Scanner",
  "status" : "Inactive"
}, {
  "notificationId" : "148VPC135xpKzx3XxHHi",
  "name" : "MatthewSmithRipwwautotesNGy",
  "description" : "MatthewSmithRipwwautotesNGy",
  "actionType" : "Scanner",
  "status" : "Inactive"
}, {
  "notificationId" : "1iG9BmZqtZnwk43UEUPJ",
  "name" : "KristyBaxterYlhbuautotesMyhkoh",
  "description" : "KristyBaxterYlhbuautotesMyhkoh",
  "actionType" : "Scanner",
  "status" : "Inactive"
}]

4. Get Workflow Notification Details

This GET method returns the details of all users for a notification specified by an <notification_id>.

Note: To execute this API, the user should have permission assigned (through policy) with action as workflows.notification.view.

GET

{{url}}/api/notifications/{{notification_id}}

Request Example

curl --location --globoff '{{url}}/api/notifications/<notification_id>' \
--h  'Authorization: {{auth}}'

Response Example 

Status: 200 Ok

{
    "notificationId" : "vhsg3vitg5z1dieivav0"    
    "name": "Y-Testing",
    "description": "",
    "status": "Active",
    "sendNoChanges": false,
    "actionType": "Email",
    "notificationMedium": [
        {
            "id": ""
        },
        {
            "id": "",
            "channels": [
                "testchannel22",
                "testchannel3"
            ]
        },
        {
            "id": ""
        }
    ],
    "rules": [
        {
            "predicate": "ProfileAccessRequestAllApprovedAndFulfilled",
            "operator": "OR",
            "description": "Access builder request approved and fulfilled"
        }
    ],
    "memberRules": [
        {
            "id": "v0akzyxj5aiodocoya2x",
            "memberType": "User"
        },
        {
            "id": "afl7qbomi9zwcneywqkt",
            "memberType": "User"
        }
    ]
}

5. Get all available rules for a Workflow Notification

This GET method returns the available rules for a workflow notification.

Note: To execute this API, the user should have permission assigned (through policy) with action as workflows.notification.view.

GET

{{url}}/api/notifications/supported_rules

Request Example

curl --location --globoff '{{url}}/api/notifications/supported_rules' \
--h  'Authorization: {{auth}}'

Response Example 

[
    {
        "predicate": "AccountsCreated",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Accounts created"
    },
    {
        "predicate": "AccountsDeleted",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Accounts deleted"
    },
    {
        "predicate": "PermissionsCreated",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Permissions created"
    },
    {
        "predicate": "PermissionsDeleted",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Permissions deleted"
    },
    {
        "predicate": "GroupsCreated",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Groups created"
    },
    {
        "predicate": "GroupsDeleted",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Groups deleted"
    },
    {
        "predicate": "ChangesToAccounts",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Accounts changed"
    },
    {
        "predicate": "ChangesToPermissions",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Permissions changed"
    },
    {
        "predicate": "ChangesToGroups",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Groups changed"
    },
    {
        "predicate": "ChangesToAwsOrganization",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "AWS Organization changed"
    },
    {
        "predicate": "ScanFinished",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Scan completed"
    },
    {
        "predicate": "ScanFailed",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Scan failed"
    },
    {
        "predicate": "AnyChangesDetected",
        "predicateType": "SCANNER",
        "operator": "OR",
        "description": "Any changes are detected"
    },
    {
        "predicate": "ProfileAccessRequestAllApprovedAndFulfilled",
        "predicateType": "ACCESS_BUILDER",
        "operator": "OR",
        "description": "Request approved"
    },
    {
        "predicate": "ApiTokenExpired",
        "predicateType": "API_TOKEN",
        "operator": "OR",
        "description": "Token expiration"
    },
    {
        "predicate": "UserCreated",
        "predicateType": "USER",
        "operator": "OR",
        "description": "User created"
    },
    {
        "predicate": "UserDeleted",
        "predicateType": "USER",
        "operator": "OR",
        "description": "User deleted"
    },
    {
        "predicate": "UserDisabled",
        "predicateType": "USER",
        "operator": "OR",
        "description": "User disabled"
    },
    {
        "predicate": "UserEnabled",
        "predicateType": "USER",
        "operator": "OR",
        "description": "User enabled"
    },
    {
        "predicate": "UserAddedToTag",
        "predicateType": "USER",
        "operator": "OR",
        "description": "User added to group"
    },
    {
        "predicate": "UserRemovedFromTag",
        "predicateType": "USER",
        "operator": "OR",
        "description": "User removed from group"
    },
    {
        "predicate": "TagCreated",
        "predicateType": "USER",
        "operator": "OR",
        "description": "Group created"
    },
    {
        "predicate": "TagDeleted",
        "predicateType": "USER",
        "operator": "OR",
        "description": "Group deleted"
    }
]

Status: 200 Ok

6. Delete Workflow Notification

This DELETE method deletes a specified workflow notification specified by <notification_id>.

Note: To execute this API, the user should have permission assigned (through policy) with the action as workflows.notification.manage.

DELETE

{{url}}/api/notifications/{{notification_id}}

Request Example 

curl -X DELETE '{{url}}/api/notifications/{{notification_id}}' -H 'Authorization: Bearer <token>'

Response Example 

Status: 200 OK