# Post Notification with request module

**URL:** <https://forum.solidproject.org/t/post-notification-with-request-module/2950>\
**Category:** Build a Solid App\
**Created:** [April 23, 2020, 3:35pm UTC](https://forum.solidproject.org/t/post-notification-with-request-module/2950 "2020-04-23T15:35:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ClaraMirandaGarcia](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/claramirandagarcia/32/1568_2.png) [@ClaraMirandaGarcia](https://forum.solidproject.org/u/ClaraMirandaGarcia)\
**Post date:** [April 23, 2020, 3:35pm UTC](https://forum.solidproject.org/t/post-notification-with-request-module/2950/1 "2020-04-23T15:35:35Z")

</div>

Hello, I’m trying to create a notification and send that notification to another user whithout using the solid hook. My problem is that the id of the notification seems to be created automatically, and so, it’s different from the one I’m passing as parameter in the createNotificationContent method (showed below).

This is what I’m currently getting:

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/solidproject/original/2X/d/d81f4a9b2886e950d65f5692fd46e9ef634fa517.png)

or, if you’d like to see the source section:

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/solidproject/original/2X/c/c4ec4912b38d72bcb47ef45353a1ffaa288deca1.png)

My code for creating the notification and its content is the following:

```
export async function postNotification(webIdFriend, content, uuid) {
    var inbox = webIdFriend + "/viade/inbox/";

    await request({
        method: "POST",
        uri: inbox,
        body: content,
        headers: {
            "Content-Type": "text/turtle"
        }
    },
        function (error, response, content) {
            if (error) { 
                return false; 
            } else {
                return true;
            }
        })
}

export function createNotificationContent(type, title, webId, routePath, time, uuid) {
    return `@prefix terms: <http://purl.org/dc/terms#>.
          @prefix as: <https://www.w3.org/ns/activitystreams#> .
          @prefix schema: <http://schema.org/> .
          @prefix solid: <http://www.w3.org/ns/solid/terms#> .
          @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
          @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
          @prefix : <${webId + `viade/inbox/` + uuid + `.ttl`}>.
          <${webId + `viade/inbox/` + uuid + `.ttl`}> a as:${type} ;
          schema:license <https://creativecommons.org/licenses/by-sa/4.0/>;
          terms:title "${title}" ;
          as:summary "${routePath}" ;
          as:actor <${webId}> ;
          solid:read "false"^^xsd:boolean ;
          as:published "${ time}"^^xsd:dateTime .`
}

```

I’m using the module [request](https://github.com/request/request) in order to do the post request.

How could I create that id myself?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jeffz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jeffz/32/600_2.png) [@jeffz](https://forum.solidproject.org/u/jeffz)\
**Post date:** [April 23, 2020, 3:42pm UTC](https://forum.solidproject.org/t/post-notification-with-request-module/2950/2 "2020-04-23T15:42:03Z")

</div>

You can _suggest_ a name for a file by adding a slug to the POST. However Solid can change that name when it stores the file. In order to know the name it stores the file under, you need to read the location header of the response from the POST. In some circumstances you create resources with PUT, those always have the exact name you gave it.

---

<div class="post-metadata">

**Author:** ![jeffz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jeffz/32/600_2.png) [@jeffz](https://forum.solidproject.org/u/jeffz)\
**Post date:** [April 23, 2020, 3:45pm UTC](https://forum.solidproject.org/t/post-notification-with-request-module/2950/3 "2020-04-23T15:45:06Z")

</div>

Here’s an example of using a slug:

```javascript
solid.auth.fetch( PARENT_CONTAINER_URI, {
  method:"POST",
  headers:{
    slug: FILENAME
    link: '<http://www.w3.org/ns/ldp#Resource>; rel="type"',
    "content-type": FILETYPE
  },
  body: FILECONTENT
})

```

---

<div class="post-metadata">

**Author:** ![ClaraMirandaGarcia](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/claramirandagarcia/32/1568_2.png) [@ClaraMirandaGarcia](https://forum.solidproject.org/u/ClaraMirandaGarcia)\
**Post date:** [April 23, 2020, 4:16pm UTC](https://forum.solidproject.org/t/post-notification-with-request-module/2950/4 "2020-04-23T16:16:20Z")

</div>

I used the slug approach and it works fine:

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/solidproject/original/2X/c/c0323015de509c77a0a83b56e2ae78f3857c4dc6.png)

Thank you so much!!
