1

I'm working with PipeDrive API and I've started to use their webhooks. The problem is that it cause loops.

Simple example:

There is a model Deal which has two methods - Deal.sync(), Deal.backsync()

Deal.sync() sends updated or created Deal object to the PipeDrive Deal.backsync() fetches Deal object from the PipeDrive

But the problem is that when I call sync, the Deal object is sent to the PipeDrive which invokes webhook so my server receives this webhook and automatically invokes Deal.backsync() etc.

I have some ideas but maybe there is some elegant way I don't know. Ideally, for example sync would send some uuid which would be sent in webhook so I know it was caused by sync.

Do you know how to make this work?

Milano
  • 18,048
  • 37
  • 153
  • 353
  • not sure if this is still an issue for you, but to deal with this in the past I've had to use some sort of storage option or custom field on the PipeDrive object as state to prevent endless loops. If the service is stateful, I would have my webhook update/check local state if it has processed a change before - same concept with using a custom field, store timestamps/info about the cause. – phouse512 Nov 26 '19 at 23:19

0 Answers0