JoseVieira
8 years agoQrew Trainee
Is it possible to use webhooks to trigger scripts?
I have a script that does some things that, as far as I understand, cannot be done with POST webhooks, but may be possible with GET. Let's say we have 3 tables, T1, T2 and T3. T3 is children of T1 and T2, but there is no relationship between T1 and T2. T2 has N records. When a new record is added to T1, I need N new records to be created on T3, like that:
1. Each new record will be related to each record of T2. That means, there will be N children on T3 related to each of the N records of T2
2. All those new N records of T3 will also be related to the new T1 record.
Trying to make thing clearer:
T1 gets a new record, with ID 'a'. T2 has N records, with ID's b1, b2, ... bN. The new record on T1 will trigger new records being created on T3 the following way:
Related T1, Related T2, data...
a, b1, ...
a, b2, ...
a, b3, ...
...
a, bN, ...
I have this working fine with my script. But I needed to put that script on a button and click on that button every time a new record is created on T1. I would like to run this script automatically when a new record is added. So, I thought about using Webhooks. What I have tried, without success, was to use as EndPoint URL the URL for my code page with the scripts, with all its querystring parameters, and selected the GET HTTP method. I'm not sure about which headers i should use for the GET. I believe that this is not Webhooks were created for but, If there is a way to run the script with or without webhooks, that's fine for me.
Thanks!
1. Each new record will be related to each record of T2. That means, there will be N children on T3 related to each of the N records of T2
2. All those new N records of T3 will also be related to the new T1 record.
Trying to make thing clearer:
T1 gets a new record, with ID 'a'. T2 has N records, with ID's b1, b2, ... bN. The new record on T1 will trigger new records being created on T3 the following way:
Related T1, Related T2, data...
a, b1, ...
a, b2, ...
a, b3, ...
...
a, bN, ...
I have this working fine with my script. But I needed to put that script on a button and click on that button every time a new record is created on T1. I would like to run this script automatically when a new record is added. So, I thought about using Webhooks. What I have tried, without success, was to use as EndPoint URL the URL for my code page with the scripts, with all its querystring parameters, and selected the GET HTTP method. I'm not sure about which headers i should use for the GET. I believe that this is not Webhooks were created for but, If there is a way to run the script with or without webhooks, that's fine for me.
Thanks!