適用於 Node.js 的 Azure 通知中樞模組Azure Notification Hubs modules for Node.js

Azure 通知中樞提供方便使用、多平台、可相應放大的推播引擎。Azure Notification Hubs provide an easy-to-use, multi-platform, scaled-out push engine. 利用單一的跨平台 API 呼叫,您就可以輕鬆地將鎖定目標且個人化的推播通知,從任何雲端或內部部署後端傳送到任何行動平台。With a single cross-platform API call, you can easily send targeted and personalized push notifications to any mobile platform from any cloud or on-premises backend.

通知中樞很適合企業和消費者案例。Notification Hubs works great for both enterprise and consumer scenarios. 以下是一些客戶使用通知中樞之用途的範例︰Here are a few examples customers use Notification Hubs for:

  • 傳送即時新聞通知給數百萬人,且延遲時間很低。Send breaking news notifications to millions with low latency.
  • 將位置型折價券傳送給感興趣的使用者區段。Send location-based coupons to interested user segments.
  • 將事件相關通知傳送給媒體/運動/財金/遊戲應用程式的使用者或群組。Send event-related notifications to users or groups for media/sports/finance/gaming applications.
  • 將促銷內容推播到應用程式來吸引客戶並進行銷售。Push promotional contents to apps to engage and market to customers.
  • 對使用者發送企業事件通知,例如新訊息和工作項目。Notify users of enterprise events like new messages and work items.
  • 傳送 Multi-Factor Authentication 的程式碼。Send codes for multi-factor authentication.

管理套件Management Package

安裝 npm 模組Install the npm module

安裝 Azure 通知中樞模組Install the Azure Notification Hubs module

npm install azure-arm-notificationhubs

範例Example

此範例會列出所有的通知中樞。This example lists all notification hubs.

const msRestAzure = require('ms-rest-azure');
const notificationHubsManagementClient = require('azure-arm-notificationhubs');

const subscriptionId = 'your-subscription-id';
const notificationHubNamespace = 'your-hub-namespace';
const resourceGroup = 'your-resource-group';
let notificationHubsClient;

msRestAzure.interactiveLogin().then(credentials => {
 notificationHubsClient = new notificationHubsManagementClient(credentials, subscriptionId);
 notificationHubsClient.notificationHubs
   .list(resourceGroup, notificationHubNamespace)
   .then(notificationHubs => console.log('Retrieved notification hubs: ', notificationHubs));
});

範例Samples

深入探索可在應用程式中使用的 Node.js 程式碼範例Explore more sample Node.js code you can use in your apps.