โ07-14-2022 01:11 PM
I am trying to create a custom static webhook trigger using the sdk. I added the connector and trigger to a recipe. I invoke the trigger using the static trigger url and the recipe does not run. I am using constant values for webhook_keys and webhook_key. And, a timestamp in dedupe. Any suggestions or working end-to-end examples? Thanks.
โ07-15-2022 04:03 AM
Hi Michael,
The issue could be the difference between the payload you are sending vs payload processing in webhook_notification.
Please note the payload structure should match the object definition defined in the output_fields block.
The below working example should give you an idea.
```
{
title: 'Static Webhook',
test: lambda do
true
end,
webhook_keys: lambda do |params, headers, payload|
'candidate'
end,
triggers: {
new_event: {
title: 'New Candidate Event',
subtitle: "Triggers when a Candidate event is received " \
"from ABC",
description: lambda do |input, picklist_label|
"New <span class='provider'>candidate event</span> " \
"in <span class='provider'>ABC</span>"
end,
input_fields: lambda do |object_definitions|
[
]
end,
webhook_key: lambda do |connection, input|
'candidate'
end,
webhook_notification: lambda do |input, payload, extended_input_schema, extended_output_schema, headers, params|
payload
end,
dedup: lambda do |record|
Time.now.to_i
end,
output_fields: lambda do |object_definitions|
[
{
name: 'id'
},
{
name: 'first_name'
},
{
name: 'last_name'
}
]
end
}
}
}
```
Sample payload:
{"id": 1,"first_name": "Chandra","last_name": "V"}
Hope this helps
โ07-15-2022 06:17 PM