How to: Post to public webhook?
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
How to: Post to public webhook?
Use Case: Send custom email/SMS to patient post visit (thank you, survey, etc.). I use Twilio for customer communication and have created a webhook that listens for an event. Is it possible for Open Dental to post to that webhook when appointment status changes to complete?
It seems API Events and API Subscriptions are designed to solve for this case but I can't seem to get it working. I've tested using https://webhook.site/ and it doesn't appear Open Dental's events are working... or, I'm doing something wrong.
It seems API Events and API Subscriptions are designed to solve for this case but I can't seem to get it working. I've tested using https://webhook.site/ and it doesn't appear Open Dental's events are working... or, I'm doing something wrong.
Re: How to: Post to public webhook?
API Events and Subscriptions are indeed how you would go about this. (https://www.opendental.com/site/apisubscriptions.html)
1. Send a Subscriptions POST request similar to below: (Note the trailing '/')
2. Send an API request that changes an appointment, such as Appointments PUT Confirm.
3. Wait up to the amount of time specified as "PollingSeconds" to receive back the Event. The JSON will appear the same as if you ran an Appointments GET request.
We were able to successfully use the Webhook.site website as an EndPointUrl. It is worth noting that the returned list will be for any changes made to an appointment, not just AptStatus.
1. Send a Subscriptions POST request similar to below: (Note the trailing '/')
Code: Select all
{
"EndPointUrl": "https://webhook.site/.../",
"WatchTable": "Appointment",
"PollingSeconds": 60
}
3. Wait up to the amount of time specified as "PollingSeconds" to receive back the Event. The JSON will appear the same as if you ran an Appointments GET request.
We were able to successfully use the Webhook.site website as an EndPointUrl. It is worth noting that the returned list will be for any changes made to an appointment, not just AptStatus.
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
Thanks. 2 clarifying question before I keep trying...
- Does the change to the appointment need to be from the API or will API Events fire regardless of change type (e.g. user changes apt status in Open Dental vs. API changes apt. status)?
- Does the endpoint need to be local or in a private network? I'm assuming not; however, webhook.site is an easy way to test and I'm not sure why this wouldn't be working.
Re: How to: Post to public webhook?
1. The change to the appointment can be done within Open Dental or via the API.
2. The endpoint does not need to be local. We were able to use webhook.site successfully.
It is worth noting that Open Dental has to be running to send the results.
2. The endpoint does not need to be local. We were able to use webhook.site successfully.
It is worth noting that Open Dental has to be running to send the results.
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
Boom, got it! Thanks!
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
@SLeon - sorry, quick follow-up question. Does the API Event payload batch all events that occurred between the last call and next call? Or, will it send individual payloads for every event?
Re: How to: Post to public webhook?
All appointments that changed since the last poll will be included in a single payload. For example, if five appointments have been changed within the poll interval, then a single payload containing a list of five appointments will be sent.
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
Thanks! Another question... I've set my workstation; however, it appears I get 2, sometimes 3 distinct calls to my hook for each change. The calls appear to be from three different hosts, one from my server and 2 others from what I presume to be other online workstations. I've tried changing my workstation to my Server Name, I've also tried using ComputerNum instead of CompName.
What am I missing?
I have a temp webhook.site up if you need to see the return. https://webhook.site/#!/3b931c01-a087-4 ... 2173c5ea/1
What am I missing?
I have a temp webhook.site up if you need to see the return. https://webhook.site/#!/3b931c01-a087-4 ... 2173c5ea/1
Re: How to: Post to public webhook?
Thank you, I am actively looking into this issue.
Re: How to: Post to public webhook?
There appeared to be a small issue where more than one workstation could fire a database event. This has been fixed and will be available in version 22.1.32.
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
A quick follow-up on this... it seems Open Dental appends "/appointmentevent" to the end of the URL for a WatchTable "Appointment". This appears to break no/low-code services with webhook integrations like Zapier and Customer.IO. Have you found this to be the case or am I missing something?
Thanks!
Thanks!
Re: How to: Post to public webhook?
One reason for appending this additional text is to indicate the response does contain the full appointment table. The returned objects are the API version of the object which contains some fields not found in the database table and is missing some that are. Appending "event" helps to make this distinction.
Could you please elaborate on how this breaks webhook integrations? These urls have not changed since Events have been implemented in 22.1.
Could you please elaborate on how this breaks webhook integrations? These urls have not changed since Events have been implemented in 22.1.
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
Thanks for the additional info. "Breaks" was a poor choice of words, sorry. I've not been able to make solutions like Zapier and Customer.IO work at all They provide a specific URL for which you can POST; however, they don't seem to work with Open Dental and the only conclusion I can come to is this additional bit of information appended at the end.
There isn't anything specific to my issue in this help article but it does provide an overview of webhooks in Zapier, should you have interest. https://help.zapier.com/hc/en-us/articles/8496288690317
There isn't anything specific to my issue in this help article but it does provide an overview of webhooks in Zapier, should you have interest. https://help.zapier.com/hc/en-us/articles/8496288690317
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
From Customer.Io support….
Re: How to: Post to public webhook?
Thank you for this information. I am looking into this issue to see if it is something on our end. I will update this thread soon.
Re: How to: Post to public webhook?
Good afternoon,
I have investigated this issue and have come to the following conclusion. Some webhook services accept additional information appended in the url, many do not. While there is no established standard, our goal is to support many different implementation strategies and help developers tailor event subscriptions to meet their individual needs. We will no longer programmatically append text (ex: "/appointmentevent") to the subscription.EndPointUrl field, and instead let the developer do so if they choose. This bugfix will be available within the week.
A simple way to get started with Events use a webhook service (such as Zapier) to generate an endpoint url. You can use this with a Subscriptions POST request in the EndpointUrl field. (See https://www.opendental.com/site/apisubscriptions.html). Events that match your subscription will be sent to this address.
If you are subscribed to both the PatientSelect UiEvent and the Patient DbEvent, therefore receiving payloads with patient information in both cases, you may want a way to distinguish them. You can append "/patientevent" or similar to your subscription.EndPointUrl string. As mentioned above, this will not work for some webhook services. Another means of distinction is with a query parameter appended to your EndPointUrl, such as "?type=patientevent" or similar.
Which of the above you decide to utilize will greatly depend on your specific situation. Because you mentioned Zapier, I successfully set up a simple Zap that uses either no appended text ("https://hooks.zapier/.../") or a query parameter ("https://hooks.zapier/...?type=patientevent").
See https://www.opendental.com/site/apievents.html for more information. Edit: This change will be available in our next beta version, 22.3.22.
I have investigated this issue and have come to the following conclusion. Some webhook services accept additional information appended in the url, many do not. While there is no established standard, our goal is to support many different implementation strategies and help developers tailor event subscriptions to meet their individual needs. We will no longer programmatically append text (ex: "/appointmentevent") to the subscription.EndPointUrl field, and instead let the developer do so if they choose. This bugfix will be available within the week.
A simple way to get started with Events use a webhook service (such as Zapier) to generate an endpoint url. You can use this with a Subscriptions POST request in the EndpointUrl field. (See https://www.opendental.com/site/apisubscriptions.html). Events that match your subscription will be sent to this address.
If you are subscribed to both the PatientSelect UiEvent and the Patient DbEvent, therefore receiving payloads with patient information in both cases, you may want a way to distinguish them. You can append "/patientevent" or similar to your subscription.EndPointUrl string. As mentioned above, this will not work for some webhook services. Another means of distinction is with a query parameter appended to your EndPointUrl, such as "?type=patientevent" or similar.
Which of the above you decide to utilize will greatly depend on your specific situation. Because you mentioned Zapier, I successfully set up a simple Zap that uses either no appended text ("https://hooks.zapier/.../") or a query parameter ("https://hooks.zapier/...?type=patientevent").
See https://www.opendental.com/site/apievents.html for more information. Edit: This change will be available in our next beta version, 22.3.22.
Last edited by SLeon on Wed Nov 30, 2022 3:15 pm, edited 3 times in total.
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
Amazing... you guys are great. Thanks!
-
- Posts: 23
- Joined: Sun Feb 27, 2022 2:53 am
Re: How to: Post to public webhook?
Dear all,
it would be helpful if it would be possible to create a button in the OD GUI to trigger an external webhook manually without using Program Links (see http://opendentalsoft.com/forum/viewtop ... f=9&t=7891). In this specific case, the next appointment may be changed by frontdesk multiple times before patient settles on a specific Date.
Joerg
it would be helpful if it would be possible to create a button in the OD GUI to trigger an external webhook manually without using Program Links (see http://opendentalsoft.com/forum/viewtop ... f=9&t=7891). In this specific case, the next appointment may be changed by frontdesk multiple times before patient settles on a specific Date.
Joerg
Re: How to: Post to public webhook?
Good morning,
Thank you for sharing your integrations with everyone. I am sure this will help other developers aiming to do similar things with their software. Could you please clarify how a traditional Program Link will not work for either of these? I believe they provide all the functionality you need.
Thank you for sharing your integrations with everyone. I am sure this will help other developers aiming to do similar things with their software. Could you please clarify how a traditional Program Link will not work for either of these? I believe they provide all the functionality you need.
-
- Posts: 23
- Joined: Sun Feb 27, 2022 2:53 am
Re: How to: Post to public webhook?
Dear SLeon,
the program link functionality works. It is only that starting a new instance of the curl cmd is slow.
Joerg
the program link functionality works. It is only that starting a new instance of the curl cmd is slow.
Joerg
-
- Posts: 83
- Joined: Wed Apr 06, 2022 12:04 pm
Re: How to: Post to public webhook?
Hi Sleon - checking on the status of this update. Has this been finished? Thanks!
Re: How to: Post to public webhook?
@joergzastrau
Program Links exist to prevent the need for a specific, additional button. If launching the cmd instance is slow, would utilizing the ApiEvents logic for the appointment table be helpful? You would be alerted to any changes made to the table, including scheduling new appointments.
@rinse-dental
The changes to ApiEvents (not appending additional information to the EndPointUrl) was added in version 22.3.22. I was just able to successfully fire an event with a dental office on this version to my testing Zapier site. You should be able to use this functionality now.
Program Links exist to prevent the need for a specific, additional button. If launching the cmd instance is slow, would utilizing the ApiEvents logic for the appointment table be helpful? You would be alerted to any changes made to the table, including scheduling new appointments.
@rinse-dental
The changes to ApiEvents (not appending additional information to the EndPointUrl) was added in version 22.3.22. I was just able to successfully fire an event with a dental office on this version to my testing Zapier site. You should be able to use this functionality now.