---
title: "Tạo thông báo push cho khảo sát: gửi ngay hoặc lên lịch (Hangfire)"
method: POST
path: "/admin/surveys/{surveyId}/notifications"
tags: ["SurveysAdmin"]
---

# Tạo thông báo push cho khảo sát: gửi ngay hoặc lên lịch (Hangfire)

`POST /admin/surveys/{surveyId}/notifications`

## Request

- Base URL: `https://api.fireant.vn`
- URL: `https://api.fireant.vn/admin/surveys/{surveyId}/notifications`
- Auth: OAuth 2
  - Implicit: `https://accounts.fireant.vn/connect/authorize`
  - Scopes: `user-data-write`
- TypeScript: <https://skmtc.dev/fireant/apis/fireant-restful-api/docs/admin/surveys/:surveyId/notifications/post.ts> (a function with typed inputs; its response is checked against the schema)

type = 1 Publish: giới thiệu khảo sát; type = 2 Reminder: nhắc người có bản nháp / trong danh sách chưa hoàn thành.
Người nhận: userNames chỉ định, hoặc quy tắc đối tượng UserName của khảo sát, hoặc topic FCM (gửi hàng loạt).
Người đã hoàn thành luôn bị loại trừ (trừ khi gửi theo topic).

## Path parameters

- `surveyId` integer, required

## Request body

- FireAntApiModelsSurveysSurveyNotificationRequest: Yêu cầu tạo thông báo push cho khảo sát (Admin)
  - `type` 1 | 2: Loại: Publish (giới thiệu) hoặc Reminder (nhắc người chưa hoàn thành) (1 = Publish, 2 = Reminder)
  - `title` string, required: Tiêu đề push (bắt buộc)
  - `body` string, required: Nội dung push (bắt buộc)
  - `topic` string: FCM topic gửi hàng loạt (VD: "all"). Dùng khi không có danh sách user; không loại trừ được người đã hoàn thành.
  - `userNames` string[]: Danh sách user nhận. Nếu bỏ trống: lấy từ quy tắc đối tượng loại UserName của khảo sát và (với Reminder) những người đang có bản nháp. Người đã hoàn thành luôn bị loại trừ.
  - `scheduledDate` string, date-time: Thời điểm gửi (null = gửi ngay)

## Response `201`

Đã tạo và lên lịch

- FireAntApiModelsSurveysSurveyNotificationItem: Thông báo push của khảo sát (gửi ngay hoặc lên lịch qua Hangfire)
  - `notificationId` integer: ID thông báo
  - `surveyId` integer: ID khảo sát
  - `type` 1 | 2: Loại: Publish / Reminder (1 = Publish, 2 = Reminder)
  - `title` string: Tiêu đề push
  - `body` string: Nội dung push
  - `topic` string: FCM topic gửi hàng loạt (nếu có)
  - `userNames` string: Danh sách user chỉ định (phân cách dấu phẩy)
  - `scheduledDate` string, date-time: Thời điểm gửi theo lịch (null = gửi ngay khi tạo)
  - `status` 0 | 1 | 2 | 3 | 4: Trạng thái (0 = Pending, 1 = Sent, 2 = Failed, 3 = Cancelled, 4 = Processing)
  - `jobId` string: Hangfire job id
  - `targetCount` integer: Số người nhận dự kiến
  - `sentCount` integer: Số push gửi thành công
  - `error` string: Lỗi (nếu có)
  - `sentDate` string, date-time: Thời điểm gửi xong
  - `createdBy` string: Người tạo
  - `createdDate` string, date-time: Ngày tạo
  - `updatedDate` string, date-time: Ngày cập nhật

## Other responses

- `400`: Dữ liệu không hợp lệ

## Changes

- **2026-09-25** `a481789cd81c`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/fireant/apis/fireant-restful-api/changes/admin/surveys/:surveyId/notifications/post.md)

---

[API](https://skmtc.dev/fireant/apis/fireant-restful-api.md) - [All operations](https://skmtc.dev/fireant/apis/fireant-restful-api/llms.txt) - [OpenAPI document](https://skmtc.dev/fireant/apis/fireant-restful-api/revisions/c9b3aa855f95?raw)
