DOCS

Last updated: 3:11 PM - December 8, 2024

Push Notification Campaign

This object represents a push notification campaign. Use it to create notification campaigns and define the content, frequency, and delivery details of push notifications sent to users.

ENDPOINTS
  • POST /v1/notifications/campaigns
  • PATCH /v1/notifications/campaigns/:id
  • GET /v1/notifications/campaigns/:id
  • GET /v1/notifications/campaigns
  • DELETE /v1/notifications/campaigns/:id

The Push Notification Campaign object

Attributes

id string

Unique identifier for the push notification campaign (MongoDB ObjectID).

userID string

The ID of the user who created the campaign.

name string

The name of the notification campaign.

content string

The content/message of the notification to be sent to users.

frequency string

The frequency of the campaign (e.g., 'daily', 'weekly').

deliverType string

How the notification is delivered (e.g., 'instant', 'scheduled').

deliverAt int64

Timestamp indicating when the notification should be delivered (Unix timestamp).

status string

The current status of the campaign (e.g., 'active', 'paused').

metadata map

Additional metadata associated with the campaign. Can contain key-value pairs for storing extra information.

created int64

Timestamp when the campaign was created (Unix timestamp).

updated_at int64

Timestamp of the last update to the campaign (Unix timestamp).

v integer

Version number of the campaign, typically used for concurrency control.

The Push Notification Campaign object
                    {
  "id": "66c39410f772e80b520398fb",
  "userID": "662eacdd93c3237c5873dc20",
  "name": "Summer Sale Campaign",
  "content": "Don't miss our summer sale! Get up to 50% off!",
  "frequency": "daily",
  "deliverType": "scheduled",
  "deliverAt": 1729006624,
  "status": "active",
  "metadata": {
  },
  "created": 1729006624,
  "updated_at": 1729006624,
  "v": 1,
}
                

Create a Notification Campaign

This endpoint creates a new notification campaign with specific details including content, frequency, delivery type, and metadata.

Required Parameters

userID string

The ID of the user creating the notification campaign.

X-API-Key string

API key for authenticating the request.

name string

The name of the campaign (e.g., 'Summer Sale Campaign').

content string

The main content or message of the campaign.

frequency string

The frequency of the campaign. For a one-time campaign, set this to 'once'.

deliver_type string

The type of delivery, e.g., 'scheduled' or 'instant'.

deliver_at integer

Unix timestamp when the campaign is scheduled to be delivered.

status string

The current status of the campaign (e.g., 'draft', 'active').

Optional Parameters

metadata object

Additional metadata for the campaign, such as 'audience' and 'priority'.

Response Parameters

campaign object

An object containing the details of the created notification campaign.

message string

A message indicating the success of the campaign creation.

status string

The status of the API request, typically 'success' if the request was successful.

POST /v1/notifications/create
curl -L 'https://api.gowithpush.com/v1/notifications/create' \
  -H 'userID: 662eacdd93c3237c5873dc20' \
  -H 'Content-Type: application/json' \
  -H 'X-API-Key: <YOUR-API-KEY>' \
  -d '{
    "name": "Summer Sale Campaign",
    "content": "Don\'t miss our summer sale!",
    "frequency": "once",
    "deliver_type": "scheduled",
    "deliver_at": 1634567890,
    "status": "draft",
    "metadata": {
        "audience": "all_users",
        "priority": "high"
    }
}'

RESPONSE

{
    "campaign": {
      "id": "67205ce1c403f48c50a02a33",
      "userID": "662eacdd93c3237c5873dc20",
      "name": "Summer Sale Campaign",
      "content": "Don't miss our summer sale!",
      "frequency": "once",
      "deliver_type": "scheduled",
      "deliver_at": 1634567890,
      "status": "draft",
      "metadata": {
          "audience": "all_users",
          "priority": "high"
      },
      "created": 1730174177,
      "updated_at": 1730174177,
      "v": 1
    },
    "message": "Campaign created successfully",
    "status": "success"
  }

Retrieve Notification Campaign

This endpoint retrieves detailed information for a specific notification campaign.

Required Parameters

campaignID string

The unique identifier of the campaign to retrieve.

userID string

The ID of the user requesting the campaign details.

X-API-Key string

API key for authenticating the request.

Optional Parameters

Response Parameters

campaign object

An object containing the details of the notification campaign.

status string

The status of the API request, typically 'success' if the request was successful.

GET /v1/notifications/{campaignID}
curl -L 'https://api.gowithpush.com/v1/notifications/66c3d2cf14b4a6acb17c4664' \
  -H 'userID: 662eacdd93c3237c5873dc20' \
  -H 'X-API-Key: <YOUR-API-KEY>'

RESPONSE

{
    "campaign": {
      "id": "66c3d2cf14b4a6acb17c4664",
      "userID": "662eacdd93c3237c5873dc20",
      "name": "First Notification",
      "content": "Come connect with us this Saturday!",
      "frequency": "once",
      "deliver_type": "",
      "deliver_at": 1724118870,
      "status": "draft:staged",
      "metadata": {},
      "created": 1724109519,
      "updated_at": 1724118870,
      "v": 1
    },
    "status": "success"
  }

List Notification Campaigns

This endpoint retrieves a paginated list of notification campaigns associated with the specified user.

Required Parameters

page integer

The page number of the paginated results.

per_page integer

The number of results to return per page.

userID string

The ID of the user requesting the campaigns.

X-API-Key string

API key for authenticating the request.

Optional Parameters

Response Parameters

campaigns array

An array of notification campaign objects.

pagination object

Information about the pagination of the results.

status string

The status of the API request, typically 'success' if the request was successful.

GET /v1/notifications
curl -L 'https://api.gowithpush.com/v1/notifications?page=1&per_page=25' \
  -H 'userID: 662eacdd93c3237c5873dc20' \
  -H 'X-API-Key: <YOUR-API-KEY>'

RESPONSE

{
    "campaigns": [
      {
        "id": "66db3482a12df8592575c0e2",
        "userID": "662eacdd93c3237c5873dc20",
        "name": "Winter Sale",
        "content": "Enjoy up to 30% off this winter season!",
        "frequency": "weekly",
        "deliver_type": "all",
        "deliver_at": 1725641858,
        "status": "active",
        "metadata": {},
        "created": 1725641858,
        "updated_at": 1725641858,
        "v": 1
      }
    ],
    "pagination": {
      "current_page": 1,
      "has_next": true,
      "has_prev": false,
      "per_page": 25,
      "total_items": 32,
      "total_pages": 2
    },
    "status": "success"
  }

Update Notification

This endpoint updates a notification's details by its ID.

Required Parameters

id string

The unique ID of the notification to be updated.

X-API-Key string

API Key for authenticating the request.

content string

The content/message of the notification.

Optional Parameters

name string

The name of the notification.

frequency string

How often the notification should be sent.

deliver_at number

Unix timestamp for when the notification should be delivered.

status string

The status of the notification.

PATCH /2024-10/notifications/update
curl -L -X PATCH 'https://api.gowithpush.com/2024-10/notifications/update?id=677e8b3feab351dd76837f5f'  
-H 'Content-Type: application/json'  
-H 'X-API-Key: <YOUR-API-KEY>'  
--data-raw '{
   "name": "",
   "content": "get your latest plan off rn!",
   "frequency": "",
   "deliver_at": 0,
   "status": ""
 }'

RESPONSE

{
   "notification": {
     "id": "677e8b3feab351dd76837f5f",
     "name": "",
     "content": "get your latest plan off rn!",
     "frequency": "",
     "deliver_at": 0,
     "status": "",
     "updated_at": 1729717316
   },
   "status": "success"
 }

Delete Notification

This endpoint deletes a notification by its unique ID.

Required Parameters

id string

The unique ID of the notification to be deleted.

X-API-Key string

API Key for authenticating the request.

Optional Parameters

DELETE /2024-10/notifications/delete
curl -L -X DELETE 'https://api.gowithpush.com/2024-10/notifications/delete?id=677e8b3feab351dd76837f5f'  
-H 'X-API-Key: <YOUR-API-KEY>'

RESPONSE

{
   "id": "677e8b3feab351dd76837f5f",
   "isDeleted": true,
   "message": "Notification deleted successfully",
   "status": "success"
 }