How to trigger a recipe from my own app, and get a custom response to my app?
I have a recipe that uses the HTTP webhook trigger. This recipe is triggered when my own external application sends a request to this recipe.
While this works, the problem is that the recipe responds immediately with a status 200, regardless of whether or not the recipe ran successfully or failed. Additionally, I can't configure a custom response.
Is there a way to get the recipe to respond only after the job has completed, with a customized response so I know if it was successful or not?
Best Answer
C
CJ Wee
said
almost 7 years ago
You can achieve this with Callable Recipes by following the steps below:
1. Create a callable recipe and set up the Input Schema which is the equivalent of a Payload example in a HTTP webhook trigger.
2. Next, configure the Response schema, which are the fields/properties that the recipe will respond with to the calling source/application.
3. In the "Enable REST endpoint" parameter, select "Yes", and configure the service path.
4. Build your recipe based on your integration requirements. The input schema generates data pills that you can use for data mapping, similar to how a payload example works when using HTTP webhook trigger.
5. Add the "Action with error monitor" action, and wrap your recipe's workflow/acitons within this block.
6a) Configure the response actions in the recipe.
6b) You'll want to have 2 of these response actions. 1 in the main recipe block, and another on an error. This is so that there is a response on both a successful job and a failed one.
7. The last step is getting to your account's API management tool.
The request format as well as URL is explained in the API managment tool page. As seen above, you'll need to pass an API token in the request header.
Click on the "Manage API tokens" button to generate this API token.
8. Lastly, start your recipe and you can test it out by sending a request to the recipe's endpoint. You can also test it out in the API management tool page.
Answer
CJ Wee
said
almost 7 years ago
You can achieve this with Callable Recipes by following the steps below:
1. Create a callable recipe and set up the Input Schema which is the equivalent of a Payload example in a HTTP webhook trigger.
2. Next, configure the Response schema, which are the fields/properties that the recipe will respond with to the calling source/application.
3. In the "Enable REST endpoint" parameter, select "Yes", and configure the service path.
4. Build your recipe based on your integration requirements. The input schema generates data pills that you can use for data mapping, similar to how a payload example works when using HTTP webhook trigger.
5. Add the "Action with error monitor" action, and wrap your recipe's workflow/acitons within this block.
6a) Configure the response actions in the recipe.
6b) You'll want to have 2 of these response actions. 1 in the main recipe block, and another on an error. This is so that there is a response on both a successful job and a failed one.
7. The last step is getting to your account's API management tool.
The request format as well as URL is explained in the API managment tool page. As seen above, you'll need to pass an API token in the request header.
Click on the "Manage API tokens" button to generate this API token.
8. Lastly, start your recipe and you can test it out by sending a request to the recipe's endpoint. You can also test it out in the API management tool page.
Saul Macht
How to trigger a recipe from my own app, and get a custom response to my app?
I have a recipe that uses the HTTP webhook trigger. This recipe is triggered when my own external application sends a request to this recipe.
While this works, the problem is that the recipe responds immediately with a status 200, regardless of whether or not the recipe ran successfully or failed. Additionally, I can't configure a custom response.
Is there a way to get the recipe to respond only after the job has completed, with a customized response so I know if it was successful or not?
You can achieve this with Callable Recipes by following the steps below:
1. Create a callable recipe and set up the Input Schema which is the equivalent of a Payload example in a HTTP webhook trigger.
2. Next, configure the Response schema, which are the fields/properties that the recipe will respond with to the calling source/application.
3. In the "Enable REST endpoint" parameter, select "Yes", and configure the service path.
4. Build your recipe based on your integration requirements. The input schema generates data pills that you can use for data mapping, similar to how a payload example works when using HTTP webhook trigger.
5. Add the "Action with error monitor" action, and wrap your recipe's workflow/acitons within this block.
6a) Configure the response actions in the recipe.
6b) You'll want to have 2 of these response actions. 1 in the main recipe block, and another on an error. This is so that there is a response on both a successful job and a failed one.
7. The last step is getting to your account's API management tool.
The request format as well as URL is explained in the API managment tool page. As seen above, you'll need to pass an API token in the request header.
Click on the "Manage API tokens" button to generate this API token.
8. Lastly, start your recipe and you can test it out by sending a request to the recipe's endpoint. You can also test it out in the API management tool page.
CJ Wee
You can achieve this with Callable Recipes by following the steps below:
1. Create a callable recipe and set up the Input Schema which is the equivalent of a Payload example in a HTTP webhook trigger.
2. Next, configure the Response schema, which are the fields/properties that the recipe will respond with to the calling source/application.
3. In the "Enable REST endpoint" parameter, select "Yes", and configure the service path.
4. Build your recipe based on your integration requirements. The input schema generates data pills that you can use for data mapping, similar to how a payload example works when using HTTP webhook trigger.
5. Add the "Action with error monitor" action, and wrap your recipe's workflow/acitons within this block.
6a) Configure the response actions in the recipe.
6b) You'll want to have 2 of these response actions. 1 in the main recipe block, and another on an error. This is so that there is a response on both a successful job and a failed one.
7. The last step is getting to your account's API management tool.
The request format as well as URL is explained in the API managment tool page. As seen above, you'll need to pass an API token in the request header.
Click on the "Manage API tokens" button to generate this API token.
8. Lastly, start your recipe and you can test it out by sending a request to the recipe's endpoint. You can also test it out in the API management tool page.