I created this procedure in my service
[httpPost]
procedure eterminPush (atext : string);
to receive the webhook
and this is the kind of request that will be send to the url:
"# Webhooks - Push Webhook
eTermin will send a POST request to the address you have specified once an appointment got created/modified/deleted. You can specify the address in the "Configuration->Integration - API->API" tab. This request contains the following information: { some kind of variables send as String }
eTermin gives this example in c#
public class Handler1 : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
try
{
string appointmentUID = context.Request.Form["APPOINTMENTUID"].ToString();
DateTime startDateTimeUTC = DateTime.ParseExact(context.Request.Form["STARTDATETIMEUTC"], "yyyyMMdd HHmmss", CultureInfo.CurrentCulture);
DateTime endDateTimeUTC = DateTime.ParseExact(context.Request.Form["ENDDATETIMEUTC"], "yyyyMMdd HHmmss", CultureInfo.CurrentCulture);
DateTime startDateTime = DateTime.ParseExact(context.Request.Form["STARTDATETIME"], "yyyyMMdd HHmmss", CultureInfo.CurrentCulture);
DateTime endDateTime = DateTime.ParseExact(context.Request.Form["ENDDATETIME"], "yyyyMMdd HHmmss", CultureInfo.CurrentCulture);
DateTime bookingDateUTC = DateTime.ParseExact(context.Request.Form["BOOKINGDATEUTC"], "yyyyMMdd HHmmss", CultureInfo.CurrentCulture);
string salutation = context.Request.Form["SALUTATION"].ToString();
string lastName = context.Request.Form["LASTNAME"].ToString();
string firstName = context.Request.Form["FIRSTNAME"].ToString();
string email = context.Request.Form["EMAIL"].ToString();
string phone = context.Request.Form["PHONE"].ToString();
string street = context.Request.Form["STREET"].ToString();
string ZIP = context.Request.Form["ZIP"].ToString();
string town = context.Request.Form["TOWN"].ToString();
string birthday = context.Request.Form["BIRTHDAY"].ToString();
string notes = context.Request.Form["NOTES"].ToString();
string customerNumber = context.Request.Form["CUSTOMERNUMBER"].ToString();
string additional1 = context.Request.Form["ADDITIONAL1"].ToString();
string additional2 = context.Request.Form["ADDITIONAL2"].ToString();
string additional3 = context.Request.Form["ADDITIONAL3"].ToString();
string additional4 = context.Request.Form["ADDITIONAL4"].ToString();
string additional5 = context.Request.Form["ADDITIONAL5"].ToString();
string additional6 = context.Request.Form["ADDITIONAL6"].ToString();
string selectedAnswers = context.Request.Form["SELECTEDANSWERS"].ToString();
string bookingLanguage = context.Request.Form["BOOKINGLANGUAGE"].ToString();
string calendarName = context.Request.Form["CALENDARNAME"].ToString();
context.Response.StatusCode = 200;
context.Response.SuppressContent = true;
context.ApplicationInstance.CompleteRequest();
/*
// Insert in DB
string connectionString = "";
System.Web.UI.WebControls.SqlDataSource dsInsert = new System.Web.UI.WebControls.SqlDataSource(connectionString, "");
dsInsert.InsertCommand = "INSERT INTO ...";
dsInsert.InsertParameters.Add("appointmentUID", appointmentUID);
dsInsert.InsertParameters.Add("startDateTimeUTC", System.Data.DbType.Date, startDateTimeUTC.ToShortDateString());
dsInsert.Insert();*/
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
//context.Response.StatusCode = 400;
//context.Response.SuppressContent = true;
//context.ApplicationInstance.CompleteRequest();
}
}
}