Page 1 of 1

How to: Post to public webhook?

Posted: Sat May 14, 2022 10:00 am
by rinse-dental
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. :D

Re: How to: Post to public webhook?

Posted: Mon May 16, 2022 12:16 pm
by SLeon
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 '/')

Code: Select all

{
"EndPointUrl": "https://webhook.site/.../",
"WatchTable": "Appointment",
"PollingSeconds": 60
}
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.

Re: How to: Post to public webhook?

Posted: Mon May 16, 2022 12:27 pm
by rinse-dental
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?

Posted: Mon May 16, 2022 1:25 pm
by SLeon
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.

Re: How to: Post to public webhook?

Posted: Mon May 16, 2022 2:41 pm
by rinse-dental
Boom, got it! Thanks!

Re: How to: Post to public webhook?

Posted: Tue May 17, 2022 9:31 am
by rinse-dental
@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?

Posted: Tue May 17, 2022 11:04 am
by SLeon
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.

Re: How to: Post to public webhook?

Posted: Wed May 18, 2022 10:43 am
by rinse-dental
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

Re: How to: Post to public webhook?

Posted: Wed May 18, 2022 11:01 am
by SLeon
Thank you, I am actively looking into this issue.

Re: How to: Post to public webhook?

Posted: Fri May 20, 2022 1:45 pm
by SLeon
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.

Re: How to: Post to public webhook?

Posted: Thu Oct 27, 2022 3:28 pm
by rinse-dental
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!

Re: How to: Post to public webhook?

Posted: Thu Oct 27, 2022 3:49 pm
by SLeon
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.

Re: How to: Post to public webhook?

Posted: Thu Oct 27, 2022 4:05 pm
by rinse-dental
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

Re: How to: Post to public webhook?

Posted: Fri Oct 28, 2022 9:53 am
by rinse-dental
From Customer.Io support….
E633606C-8967-43F9-AE3B-D8DF5A028B8B.png
E633606C-8967-43F9-AE3B-D8DF5A028B8B.png (668.36 KiB) Viewed 4334 times

Re: How to: Post to public webhook?

Posted: Mon Oct 31, 2022 7:54 am
by SLeon
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?

Posted: Thu Nov 03, 2022 3:08 pm
by SLeon
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.

Re: How to: Post to public webhook?

Posted: Thu Nov 03, 2022 3:29 pm
by rinse-dental
Amazing... you guys are great. Thanks!

Re: How to: Post to public webhook?

Posted: Mon Nov 07, 2022 3:50 am
by joergzastrau
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

Re: How to: Post to public webhook?

Posted: Mon Nov 07, 2022 11:01 am
by SLeon
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.

Re: How to: Post to public webhook?

Posted: Tue Nov 08, 2022 7:03 am
by joergzastrau
Dear SLeon,

the program link functionality works. It is only that starting a new instance of the curl cmd is slow.

Joerg

Re: How to: Post to public webhook?

Posted: Wed Nov 30, 2022 8:31 am
by rinse-dental
Hi Sleon - checking on the status of this update. Has this been finished? Thanks!

Re: How to: Post to public webhook?

Posted: Fri Dec 02, 2022 11:31 am
by SLeon
@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.