Webook Implementation Details

I’m curious to know what protocol is used for webhooks.

I’m aware that when the data is transmitted from the Particle Cloud service to the hook destination HTTP is used. But is the data being transmitted from the device to the Particle Cloud sent via SMS? Or is it accomplished by some other method?

The Particle devices themselves can handle HTTP, so then there wouldn’t be a need for webhooks. They come in with HTTPS, which has more hardware restraints on the devices.

It’s hard to send an SMS without a cellular module, so no, it’s not SMS ;). Depending on which device is being used, that’d be UPD or TCP (if I’m not mistaken).

To clarify I am using an Electron, so I have a cellular module on board. And I’m already using webhooks, so this discussion is not about a need for them.

But if UDP or TCP is being used, there should still be a data format protocol that Particle is using. There’s more to the transmission than just sending the data in bytes. The protocol may be proprietary, but I’m wondering if Particle will share that with us.

The connection between the Electron and the cloud is CoAP over DTLS. This connection is used for all of the cloud features like publish and subscribe, variables, functions and OTA code flash. In the case of webhooks, the publish goes over this channel, which triggers the webhook. The same channel is used for the return data. It’s authenticated using RSA public keys and encrypted.

4 Likes

Something like this?

1 Like

@rickkas7 thanks so much! Your feedback is invaluable. Is it on the Particle side that the payload is limited to 255 bytes? From a brief scanning of the spec RFC t doesn’t look like that is a constraint of the CoAP protocol.

1 Like

Correct, the publish payload is limited for various reasons, including memory on the Photon/Electron and resources used by the cloud servers, and is enforced by both sides, but it’s somewhat arbitrary.

2 Likes