javaintunemicrosoft-graph-intune

Intune executeAction customTextNotification 400 Bad Request


I want to execute action customTextNotification but i am getting error 400 Bad Request. And I don't have any access to graph explorer and the test device that receives the message. All I have is the code in backend in Java and logs.

Here are the details.

URL POST beta/deviceManagement/managedDevices/executeAction

Body {"actionName":"customTextNotification","deviceIds":["single device ID is here"],"notificationTitle":null,"notificationBody":"BF test - 12/8/2023 - 7:34AM EST","deviceName":null}

Roles I see in the token

When I check the documentation (https://learn.microsoft.com/en-us/graph/api/intune-devices-manageddevice-executeaction?view=graph-rest-beta) It doesn't really tell me if a field is required. Perhaps I am missing a field.

I want to know what I need to run customTextNotification.


Solution

  • Finally got someone to test it on their Azure server. The issue is "notificationTitle" is required. Just need to add value for it and 400 Bad Request is gone.

    Sample request body.

    {"actionName":"customTextNotification","deviceIds":["single device ID is here"],"notificationTitle":"test notification","notificationBody":"test message","deviceName":null}