API - Notification API for individuals (revamp)

Usage

Use this API when you want to send a notification to one (or a few) users.

Use case examples:

  • Personalized notifications

  • Triggered notifications

If you want to send the same notification to multiple users, the Notification API for audience will give better results

Authentication and Authorization

You will have to ask your implementation manager to create a key/secret combination for you.

The API authentication is done using HTTP Basic Authentication. You need to add an Authorization header to every request:

Authorization: Basic <token>

where <token> is a base64 encoded string of key:secret

Create (send) a Notification

The notification will be sent as soon as it is created and you will get the results in the response.

Endpoint URL

Preproduction: https://notification.greencopper.net/preprod/send/<project-tag>
Production: https://notification.greencopper.net/prod/send/<project-tag>
(no trailing slash)

HTTP Method

POST

Request body

Body should be valid JSON

Attribute

Type

Required

Notes

Attribute

Type

Required

Notes

title

Object

Yes

Provide the notification title in the project’s each language code in ISO 639-2 format. Max 140 characters per language.

body

Object

No

Provide the notification body in the project’s each language code in ISO 639-2 format. Max 140 characters per language.

gc_user_ids

Array of strings

Yes

A list of GC user IDs you want the notification to be sent to

(maximum of 500 IDs per call)

deeplink

String

No

A deeplink that will open when the user clicks on the notification. For example:

myapp://activitiesList

Ask your implementation manager to get a list of available deeplinks for your app

Request example

{ "title": { "en": "Test 1" }, "gc_user_ids": [ "724d4eda-d7f7-4742-be15-6ca948aa11d3" ], "deeplink": "myapp://activitiesList" }

Multi-language

{ "title": { "en": "English title here", "fr": "Titre en français ici" }, "body": { "en": "The message content in English here", "fr": "Le contenu du message en français ici" }, "gc_user_ids": [ "724d4eda-d7f7-4742-be15-6ca948aa11d3", "16481890-ff1e-4db5-ba39-45792e629f77" ] }

Responses

Notifications are sent immediately and the response will give you the results.

Response statuses

  • Created with success: 200
    Check body to see if delivery was successful or not

  • Validation errors: 400
    Check body for error details

  • Server error: 500

  • Invalid credentials: 401

Response examples

All sent with success
Status: 200

Partial failure
Status: 200

General failure
Status: 500