Question

Is there a way to execute a workflow without an alert but instead use an REST API call?


Badge

Is there a way to execute a workflow without an alert but instead use an REST API call?



🗨 Link to Slack thread

13 replies

Badge

For example, using https://api.bettercloud.com/api/v1/workflows/{workflowid}/execute

Userlevel 5
Badge +2

Yep! For sure. You can use that exact endpoint

Userlevel 5
Badge +2

For now, you'd have to define an alert and provide the context for that alert

Userlevel 5
Badge +2

Coming soon will be the ability to define your own context

Badge

Nice!! Thanks Mike.

I am not exactly a dev person, so I am using postman as test and "development" bench.

where do I define the parameters / context?

This is my output running list of workflows:

workflowId": "ID",
            "name": "Offboarding Employees",
            "eventDetail": {
                "connectorId": "connectorId",
                "providerId": "providerId",
                "name": "User Added to Group",
                "parameters": [
                    {
                        "key": "groupId"
                    },
                    {
                        "key": "userId"
                    }
                ]
            }

but continue to get a http message not readable.

Userlevel 5
Badge +2

Ah the parameters would be in the “Body’ in postman

Userlevel 5
Badge +2

make sure to set the body to JSON

Userlevel 5
Badge +2

so in your case the body would look like this:

Userlevel 5
Badge +2

{groupId:"test1", userId:"user@copmany.com"}

Badge

Genius! thanks. That work, at least it run it. I will continue to fine tune it. but that huge help,

Userlevel 5
Badge +2

Nice!!!

Userlevel 5
Badge +2

Happy to help, let us know if you have any other questions

Userlevel 2
Badge +2

Hey @dalfonzo, if you get to a point where you think you’d need some help, feel free to book some office hours with us. As Mike said, we’d be happy to help with it!
https://calendly.com/eag-consult/custom-integrations-office-hours?back=1&month=2020-07

Reply