Obtain Agent URL without Blinkup SDK

Is there any way for an external system to obtain the Agent URL of a newly blessed imp without using the Blinkup SDK? We are using the imp.setenroltokens() function rather than having end users blinkup their imps at the end and it is unclear how we are supposed to acquire the Agent URL using this method.

In the old forum answer below, it is stated that one of the webhooks should provide the Agent URL but I have tested all three different webhooks and it did not appear in the body of any of them. Presumeably that feature was removed?


I’m aware I could have the device call http.agenturl() and send off its URL to our system on startup however this would not mesh well with our current system design.

I don’t think anything was removed - but having the agent self-report its URL is essentially the same as having a webhook fire. Is there a reason why webhooks were acceptable but a webhook call by an agent is not?

The issue is that a new agent is an unknown location to our system and so our security will ignore it. Thinking about it, the blinkup webhook wouldn’t work either if it sent from the new device.

Something like the Build API, where a fixed known location can be asked for the Agent URL of a device of known Device Id would be perfect. Incidentally I am unable to find any information on production imps in the Build API. Can production imps be accessed at all from the Build API?

The Build API is intended for development imps. There are more APIs coming which relate to production imps.

As your agent code is secure, can’t you just sign requests (even from new agents) so that your backend will believe they are valid?

Potentially. It would require rethinking our security model a little but if no other way exists then so be it. Thank you for your help

Can’t you get the device to pass its device ID to its agent on first post-blessed boot (assuming this is coincident with end-user BlinkUp; you’ll need to set the production model to download to the device at this time, not immediately after blessing)? The agent will then contact your server with the device ID and its own URL. Your server matches the device ID against the one received via the BlinkUp webhook and, if there’s a match, creates a new device record with the ID and the agent URL. The agent records the transmission of the data in its persistent storage so this registration process isn’t repeated the next time the device and/or agent restarts.

Yeah something along those lines is looking like our best bet. Thanks for the suggestion