Integration for product vs integration for normal account

Hello Readers,

I’ve been developing on my particle devices and have reached a stage where I would like to deploy a few devices for a field trail. So I decided to use particle’s “product” feature to help control, deploy firmware updates for these devices as well as monitor and manage them.

I’ve successfully created a product, added devices to the group and product ID + version into the firmware. All is well but I realized that there is a separate “integration” tab for the product. Seeing that they are empty, I realized that my deployed units are still using the webhooks + other integration items created on my own account. So I have a few questions:

  • Is there a good way to “import” these integration configurations into a product? I am trying to avoid manually recreating these integration items
  • Aside from changing the “Event Name” is there a good way to control which webhooks I use (i.e. product webhooks or development webhooks). The reason being is that the “development” units I have in my product may point to a staging server where as my fully deployed units will point to a production server. I would like to know if there are options to avoid changing the event names in the firmware code or the event names/config URL on the cloud to minimize human error. Is it possible I query particle to check if my device is marked as development? I can then use this flag to select event items on the firmware.
  • Assuming I have multiple products with multiple integration items, is there a good way to track which webhook I am using. Currently each product seems to have its own integration items/tab but devices added the products can still use webhooks from the entire account (Need more testing). Good event naming is a solution but I am wondering if I can force a device which is added to a product group to only use integration items in the product group.

Relevant Docs:

Is there a good way to “import” these integration configurations into a product? I am trying to avoid manually recreating these integration items

If you edit the Integration, click on Custom Template and it will show the JSON for the integration. You can copy that JSON data, which contains all of the settings for the webhook.

You can also download the webhook JSON using the Particle CLI, but the Particle CLI doesn't have the ability to upload a product webhook, so copy and paste is the easiest way.

Aside from changing the “Event Name” is there a good way to control which webhooks I use (i.e. product webhooks or development webhooks). The reason being is that the “development” units I have in my product may point to a staging server where as my fully deployed units will point to a production server.

There is not, but that's because there's a different method of development that's recommended.

Instead of developing in your developer account, create two products, one for prod and one for development/staging. Do not create any webhooks in your own account, only create them at the product level. That way the correct prod or dev webhook will be used, depending on which product your device is associated with.

When doing development in the dev product, use the Mark As Development Device option in the product so you can flash code directly to the device from your account, eliminating the need to upload the firmware binaries during iterative development.

Assuming I have multiple products with multiple integration items, is there a good way to track which webhook I am using.

Not built-in, but you could add a parameter in what you send to your server that indicates which webhook was used.

Currently each product seems to have its own integration items/tab but devices added the products can still use webhooks from the entire account

Yes, both device owner and product webhooks are used if both are present. The solution is to not using any device owner webhooks.

Incidentally, for your actual product we recommend creating a separate Particle account to own the devices that's separate from your development account. It will work either way, but it can make things less confusing and is helpful if you eventually have more than one person working on the product.

3 Likes