Webhooks with POST requests: Difference between revisions

From Planfix
Jump to: navigation, search
No edit summary
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 13: Line 13:
Let's set up the webhook that will create contacts:
Let's set up the webhook that will create contacts:
*Specify POST request as the type:
*Specify POST request as the type:
https://s.pfx.so/pf/21/ujhzDv.png
https://s.pfx.so/pf/dG/bYcWdL.png
 
 
*Webhook links contain a unique code, but we can replace it as needed with something more informative:
https://s.pfx.so/pf/dS/T2bvZX.png
 
 
*In the webhook parameters, add field names from the feedback form:
https://s.pfx.so/pf/Uq/tI7hsl.png
 
 
*We specify the name of the person to whom the action will be attributed in Planfix after the webhook has been triggered:
https://s.pfx.so/pf/u5/pozSoU.png
 
 
*We select the type of operation and configure it. Ultimately, Planfix will create a new contact using the specified template, add a Name from the name parameter in the link and a Phone Number from the phone parameter in the link, and then notify the required employee about the new contact:
https://s.pfx.so/pf/Ll/HBHNtp.png
 
 
*Then add additional operations as needed, and in the last step specify what kind of response you would like to receive from the webhook: JSON, transition to Planfix, or transition to your website:
https://s.pfx.so/pf/SY/IzZ5Bn.png
 
 
*Then add the webhook link to the code for the feedback form on your site:
<div style="width:100%; margin: 0 0 10px; font-size: 13px; line-height: 1.65; word-break: break-all; color: black; background-color: #f9f9f9; border: 1px solid #ddd; padding: 1em 1em 0px 1em; font-family:monospace,Courier; border-radius: 4px;">
<form method="post" action="<nowiki>https://</nowiki>own_account.planfix.ru/webhook/POST/create_contact"><br>
&nbsp;&nbsp;<input type="text" name="<span style="color:green;">name</span>" placeholder="<span style="color:red;">First name</span>"><br>
&nbsp;&nbsp;<input type="text" name="<span style="color:green;">phone</span>" placeholder="<span style="color:red;">Phone</span>"><br>
&nbsp;&nbsp;<input type="submit" name="submit" value="Submit"><br>
</form>
</div>
 
 
*When a customer fills out the feedback form with their '''name''' and '''phone number''' and then clicks the '''Submit button''':
https://s.pfx.so/pf/jH/zy4i3F.png
 
 
*The values from the form fields are added to the webhook and sent to Planfix, where a new contact is automatically created:
https://s.pfx.so/pf/Ei/NF5Cyy.png
 
 
== Go To ==
*[[Webhooks with GET requests]]
*[[Incoming webhooks]]

Latest revision as of 14:44, 23 September 2022

In order to understand how webhooks work with POST requests, let's look at a simple example of creating a contact in Planfix for a person who has filled out a feedback form on your site.

Sample webhook with a POST request:

https://ваш_аккаунт.planfix.ru/webhook/POST/create_contact


Let's set up the webhook that will create contacts:

  • Specify POST request as the type:

bYcWdL.png


  • Webhook links contain a unique code, but we can replace it as needed with something more informative:

T2bvZX.png


  • In the webhook parameters, add field names from the feedback form:

tI7hsl.png


  • We specify the name of the person to whom the action will be attributed in Planfix after the webhook has been triggered:

pozSoU.png


  • We select the type of operation and configure it. Ultimately, Planfix will create a new contact using the specified template, add a Name from the name parameter in the link and a Phone Number from the phone parameter in the link, and then notify the required employee about the new contact:

HBHNtp.png


  • Then add additional operations as needed, and in the last step specify what kind of response you would like to receive from the webhook: JSON, transition to Planfix, or transition to your website:

IzZ5Bn.png


  • Then add the webhook link to the code for the feedback form on your site:

<form method="post" action="https://own_account.planfix.ru/webhook/POST/create_contact">
  <input type="text" name="name" placeholder="First name">
  <input type="text" name="phone" placeholder="Phone">
  <input type="submit" name="submit" value="Submit">
</form>


  • When a customer fills out the feedback form with their name and phone number and then clicks the Submit button:

zy4i3F.png


  • The values from the form fields are added to the webhook and sent to Planfix, where a new contact is automatically created:

NF5Cyy.png


Go To