# إنشاء إشعارات عبر API

**URL:** <https://meta.discourse.org/t/creating-notifications-via-the-api/173769>\
**Category:** Development\
**Tags:** notifications, rest-api\
**Created:** [17 ديسمبر 2020، 10:55ص UTC](https://meta.discourse.org/t/creating-notifications-via-the-api/173769 "2020-12-17T10:55:49Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)\
**Post date:** [19 ديسمبر 2020، 2:32م UTC](https://meta.discourse.org/t/creating-notifications-via-the-api/173769/11 "2020-12-19T14:32:50Z")

</div>

> [@pfaffman](#):
>
> ما أودّه هو القدرة على وضع رابط النموذج الذي استدعاه.

ينشئ [DefaultNotificationItem](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/app/widgets/default-notification-item.js#L34) `url` تلقائيًا إذا قمت بتعبئة `data.badge_id` أو `topic_id` أو `data.group_id`.

> [@renato](#):
>
> هل من الآمن ببساطة تجاوز `url` عندما يكون هناك شيء محدد في `data`؟

اختبرتُ هذا النهج وهو يعمل. ما عليك سوى تعبئة `data.url` واستخدامه في مكون السمة:

```js
  api.reopenWidget("custom-notification-item", {
      url(data) {
          return data.url || this._super(data);
      }
  })

```

---

_[View the full topic](https://meta.discourse.org/t/creating-notifications-via-the-api/173769)._
