Skip to main content

I have a REST service that sends a customized email notification to all employees. [ With JSON

as input ]

I want to integrate this REST API with Pipefy, so when a card is created in pipefy, I want to

format card info (Data from Pipefy webhook) and do the job.

Information:

Created a webhook in pipefy using "https://app.pipefy.com/graphiql" using mutation

"createwebhook" and, webhook is created with an id

Question:

How can I use this webhook and how can I call my own REST API (or how this webhook

interacts with my REST API ?)

Please suggest

Hello Amanda!
Firstly, I would suggest you to take a look at our built-in feature called Email Template.(https://help.pipefy.com/en/articles/614616-email-templates) That might solve your problem straight up!


If you’d like to know how to create a webhook, you can log onto Pipefy and access our GraphiQL IDE (https://app.pipefy.com/graphiql), and create it through there. Here’s an example of the code:

mutation{
createWebhook(input:{
actions:"card.create"
name:"Webhook-Name"
url:"https://test.requestcatcher.com/"
email:"amanda@email.com"
pipe_id:1242952
}) {
clientMutationId
}
}

You can use sites like requestcatcher.com to test your webhook events.

After the webhook is configured, Pipefy will listen to events in the configured pipe, such as "card.created". From that, it will send a POST request to your specified URL containing some basic card data in JSON. After that, how to proceed is determined by your business logic.


mutation {
createWebhook(input:{
actions: ["card.done"],
name: "SAP",
url: "http://x.x.x.x:8080/v1/public/sap-integrator/invoice",
headers: {Authorization:"Basic xxx"},
pipe_id: 302174055
}){
webhook {actions, headers, id, name, url}
}
}

I’m getting error 500 when sending “headers”, could you help-me?


Hi there @tiago260!

 

You can try something like this:

mutation {
createWebhook(input:{
actions: :"card.done"],
name: "SAP",
url: "http://x.x.x.x:8080/v1/public/sap-integrator/invoice",
headers: :"Authorization", "Basic xxx"],
pipe_id: 11111
}){
webhook {actions, headers, id, name, url}
}
}


 

 


It works


I tried sending headers as an array, but not working as well:

{
"data": {
"createWebhook": null
},
"errors": [
{
"message": "Validation failed: invalid headers",
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"createWebhook"
],
"code": 30003,
"type": "ResourceNotFoundError"
}
]
}

any help?


The solution is wrong and the documentation may not be clear enough.

When it says:
headersJson. The webhook's custom headers
It means you have to stringify it

So, for the example, you have to replace
headers: {Authorization:"Basic xxx"}
by
headers: "{\"Authorization\":\"Basic xxx\"}"


Vashnak is absolutely right: the headers parameter must be a stringfied json (this website is very handy to do it: https://jsonformatter.org/json-stringify-online).

I’ve made a test and it worked: