Can you attach Device ID to the reply of a Device name request?

I am trying to use Particle.publish("particle/device/name/"); so that my fleet can retrieve their names to later set as their wifi hostname. The issue is that all devices in the fleet see all responses, and don’t have a way to differentiate which response is their own.
Is there a way to attach the coreid to the server response in a similar way described for product webhooks?

That method seems fine if you’re getting a result from an external service, but I can’t figure out how to adjust the responses when you are only getting info from the Particle server.

This was brought up in this conversation here, though a solution was never posted.

The device name response should be received by the device itself - not its peers - for it to know its own cloud name.
Once the device knows its own name it can republish that name plus its device ID (which it knew all along) if needed.

IIRC since the deprecation of the PUBLIC event stream product devices should not see any of the events published by their peers nor the respective responses.
@rickkas7, has this behaviour changed “recently”?

Right, that’s the goal. But currently with all of the devices subscribed to ‘particle/device/name’, they all receive each response, even with the PRIVATE flag on the publish. For more context I am using an offline implementation of the Particle server, which may not have implemented some of the changes you mention.

In that case you need to adapt the server code yourself.
Particle has provided the basic open source version of a standalone cloud server as a stepping stone for own implementation but has never officially supported it and has discontinued it years ago.

However, since Particle.publish() does send the device ID with the event is should be possible to use that info when generating the response.
But since I never looked into the standalone server code I wouldn’t know where that portion of the code sits. Even more so as I doubt you are using the vanilla Particle code but rather someone else’s fork of that.

I feared that might be the case, but I just wanted to verify that there was no alternative way to do it with webhooks.

Thanks for your help!

Not sure if this is what you’re asking, but this combination of subscribe syntax and webhook response settings works for internal calls of my device to get some of its own attributes, including name and serial:

Boron code:

Particle.subscribe(System.deviceID() + "/hook-response/getParticleDetails", getParticleDetailsHandler, MY_DEVICES);
Particle.publish("myTopicPrefix/getParticleDetails", System.deviceID(), 60, PRIVATE);

Triggers a GET Webhook on:{{{PARTICLE_DEVICE_ID}}}

with a Webhook Response Topic of:

using Webhook Response Template of:

And finally back in the Boron (using @rickkas7 JsonParser lib):

void getParticleDetailsHandler(const char *event, const char *data) {
    if (data != "") {
        JsonParser parser;