Classes

Notifications

Typedefs

CampaignTarget : object
Task : object
Campaign : object
Tag : Object
Target : Object
Subscribtion : Object
Campaign : object
Task : Object
 

Notifications

Kind: global class

 

new Notifications()

Experimental notifications service

 

notifications.api([acl]) ⇒ object

API Factory

Kind: instance method of Notifications
Returns: object - - the graphql api object

Param Type Default Description
[acl] Array.<string> \ function limit api to array of groups or use auth function
 

notifications.createCampaign(name, action, [data], options) ⇒ Promise.<Campaign>

Upsert the campaign If the campaing does not exists add new. Otherwise, update it.

Kind: instance method of Notifications

Param Type Description
name string
action string
[data] object
options object use { id: '...' } to make campaign accessible from code
 

notifications.pushTasksToQueue(campaignTargets) ⇒ Promise.<Array.<Task>>

Add tasks to process by queue

Kind: instance method of Notifications

Param Type
campaignTargets Array.<CampaignTarget>
 

notifications.subscribe(senderId, pageId, tag)

Subscribe user under certain tag

Kind: instance method of Notifications

Param Type
senderId string
pageId string
tag string
 

notifications.unsubscribe(senderId, pageId, [tag], [req], [res])

Unsubscribe user from certain tag or from all tags

Kind: instance method of Notifications

Param Type Default
senderId string
pageId string
[tag] string null
[req] object
[res] object
 

notifications.processMessage(event, pageId) ⇒ Promise.<{status:number}>

Preprocess message - for read and delivery

Kind: instance method of Notifications

Param Type
event object
pageId string
 

notifications.getSubscribtions(senderId, pageId) ⇒ Promise.<Array.<string>>

Get user subscribtions

Kind: instance method of Notifications

Param Type
senderId string
pageId string
 

notifications.runCampaign(campaign) ⇒ Promise.<{queued:number}>

Run the campaign now (push tasks into the queue)

Kind: instance method of Notifications

Param Type
campaign object
 

notifications.sendCampaignMessage(campaign, processor, pageId, senderId, [data]) ⇒ Promise.<{status: number}>

Sends the message directly (without queue) and records it's delivery status at campaign stats

Kind: instance method of Notifications

Param Type Default Description
campaign object campaign
processor object channel processor instance
pageId string page
senderId string user
[data] object override the data of campaign

Example

const campaign = await notifications
    .createCampaign('Custom campaign', 'camp-action', {}, { id: 'custom-campaign' });

await notifications.sendCampaignMessage(campaign, channel, pageId, senderId);
 

Notifications.Notifications

Kind: static class of Notifications

 

new Notifications(notificationStorage, options)

Creates a new instance on notification service

Param Type Description
notificationStorage NotificationsStorage
options object
[options.log] console logger
[options.default24Clearance] number use this clearance to ensure delivery in 24h
[options.allAudienceTag] string tag to mark all users
 

CampaignTarget : object

Kind: global typedef
Properties

Name Type Description
senderId string sender identifier
pageId string page identifier
campaignId string campaign identifier
[data] object custom action data for specific target
[enqueue] number custom enqueue time, now will be used by default
 

Task : object

Kind: global typedef
Properties

Name Type Description
id string task identifier
pageId string page identifier
senderId string user identifier
campaignId string campaign identifer
enqueue number when the task will be processed with queue
[data] object custom action data for specific target
[read] number time of read
[delivery] number time of delivery
[sent] number time of send
[reaction] boolean user reacted
[leaved] number time the event was not sent because user left
 

Campaign : object

Kind: global typedef
Properties

Name Type Description
id string
name string Tatgeting
include Array.<string>
exclude Array.<string>
pageId string Stats
sent number
failed number
delivery number
read number
notSent number
leaved number
queued number Interaction
action string
[data] object Setup
sliding boolean
slide number
active boolean
in24hourWindow boolean
allowRepeat boolean
startAt number
slideRound number
 

Tag : Object

Kind: global typedef
Properties

Name Type
tag string
subscribtions number
 

Target : Object

Kind: global typedef
Properties

Name Type
senderId string
pageId string
 

Subscribtion : Object

Kind: global typedef
Properties

Name Type
senderId string
pageId string
subs Array.<string>
 

Campaign : object

Kind: global typedef
Properties

Name Type Description
id string
name string Tatgeting
include Array.<string>
exclude Array.<string>
pageId string Stats
sent number
failed number
delivery number
read number
notSent number
leaved number
queued number Interaction
action string
[data] object Setup
sliding boolean
slide number
active boolean
in24hourWindow boolean
allowRepeat boolean
startAt number
slideRound number
 

Task : Object

Kind: global typedef
Properties

Name Type Description
id string
pageId string
senderId string
campaignId string
enqueue number
[read] number
[delivery] number
[sent] number
[insEnqueue] number
[reaction] boolean user reacted
[leaved] number time the event was not sent because user left

results matching ""

    No results matching ""