Forum Discussion

Slamdoor's avatar
Slamdoor
Copper Contributor
Nov 10, 2023

Issue Creating InTune Compliance Notification

Hi, complete Graph newbie here trying to learn the ropes. Currently using the Graph explorer to get comfortable. We're an MSP, so we set up a lot of InTune tenants for customers and currently do it manually, I'd like to automate a lot of it which I've done with regular old PowerShell, but some of it seems to be restricted to the (better) Graph.

Currently, I'm using https://learn.microsoft.com/en-us/graph/api/intune-notification-notificationmessagetemplate-create?view=graph-rest-1.0&tabs=http

and

https://learn.microsoft.com/en-us/graph/api/intune-notification-localizednotificationmessage-create?view=graph-rest-1.0&tabs=http

To try and create a POST request to: https://graph.microsoft.com/v1.0/deviceManagement/notificationMessageTemplates

This is what I have:

{
    "@odata.type": "#microsoft.graph.notificationMessageTemplate",
    "displayName": "Your Template Name",
    "defaultLocale": "en-us",
    "brandingOptions": "includeCompanyLogo",
    "localizedNotificationMessages": [
        {
            "@odata.type": "#microsoft.graph.localizedNotificationMessage",
            "locale": "en-us",
            "subject": "Your Notification Subject",
            "messageTemplate": "Your Notification Message",
            "isDefault": true
        }
    ]
}

In the request body using Graph explorer. A lot of values are place holders but they should still create just to test. Initially I was getting errors with the payload but have fixed those.

Now, no matter how much modifying I do, I always get this as 400 bad request error:

 

{
    "error": {
        "code": "BadRequest",
        "message": "{  \"_version\": 3,  \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 2e3410e5-8f41-8b2f-755c-f42d2944e26d - Url: https://fef.msub07.manage.microsoft.com/StatelessNotificationFEService/deviceManagement/notificationMessageTemplates?api-version=5018-07-01\",  \"CustomApiErrorPhrase\": \"\",  \"RetryAfter\": null,  \"ErrorSourceService\": \"\",  \"HttpHeaders\": \"{}\"}",
        "innerError": {
            "date": "2023-11-10T14:24:35",
            "request-id": "efbf0aae-23bf-445f-83e8-141c3d0e7255",
            "client-request-id": "2e3410e5-8f41-8b2f-755c-f42d2944e26d"
        }
    }
}

Could anyone help me identify what's wrong, or point me where I can learn more?

Thank you so much.

No RepliesBe the first to reply

Resources