Notifications

Notifications are what you'll use to send push notifications to users.

The notification model

You can set the title, body and url of the notification. We'll include your organization name and logo in the notification automatically. You can change these at any time in the settings page.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the notification.

  • Name
    title
    Type
    string
    Description

    The title of the notification.

  • Name
    body
    Type
    string
    Description

    The main content of the notification.

  • Name
    url
    Type
    string
    Description

    The link attached to the notification.


POST/v1/notify

Send a notification

Send a push notification to a single user. While we recommend using webhooks to know whether the user has connected or not, you can also use the response from this endpont. A 200 response means the notification was sucessfully delivered to their device.

Required attributes

  • Name
    user_id
    Type
    string
    Description

    The same unique identifier you provided when creating the connection intent.

  • Name
    title
    Type
    string
    Description

    The title of the notification. Try keep this less than a sentence.

  • Name
    body
    Type
    string
    Description

    The main content of the notification. Best to keep this to a few sentences max.

Optional attributes

  • Name
    url
    Type
    string
    Description

    A link the user will navigate to when they click the notification from their phone or inside the app. Make sure it's a valid URL.

Request

POST
/v1/notify
curl 'https://notify.dev/api/v1/notify' \
  -H 'Authorization: {token}' \
  -d '{
    "user_id": "hahahaha",
    "title": "Hello person",
    "body": "This is a test notification",
    "url": "https://google.com"
  }'

Response

200
{
  "message": "Notification delivered",
  "notification_id": "ntf_xxx"
}

Response

406
{
  "message": "The user has paused notifications for your app"
}

Response

404
{
  "message": "No connection found for that user id",
}

POST/v1/notify/many

Send multiple notifications

Send a push notification up to 100 users at once. If one of the user_ids is invalid or the users hasn't connected with Notify yet, the rest of the notifications will still be sent but the user_id won't be included in the response.

Required attributes

  • Name
    user_ids
    Type
    string[]
    Description

    An array of unique identifier you provided when creating the connection intent.

  • Name
    title
    Type
    string
    Description

    The title of the notification. Try keep this less than a sentence.

  • Name
    body
    Type
    string
    Description

    The main content of the notification. Best to keep this to a few sentences max.

Optional attributes

  • Name
    url
    Type
    string
    Description

    A link the user will navigate to when they click the notification from their phone or inside the app. Make sure it's a valid URL.

Request

POST
/v1/notify
curl 'https://notify.dev/api/v1/notify/many' \
  -H 'Authorization: {token}' \
  -d '{
    "user_ids": ["user1", "user2"],
    "title": "Hello person",
    "body": "This is a test notification",
    "url": "https://google.com"
  }'

Response

200
{
  "message": "Notifications dispatched",
  "notifications": [
    {
      "user_id": "user_id_one",
      "notification_id": "ntf_xxx"
    },
    {
      "user_id": "user_id_two",
      "notification_id": "ntf_xxx"
    }
  ]
}

Response

200
{
  "message": "No user_ids provided. No notifications sent."
}

Response

200
{
  "message": "No active connections found. No notifications sent."
}

Response

400
{
  "message": "Too many user_ids provided. Max 100. No notifications sent.",
}

Was this page helpful?