Classes

Notifications

Typedefs

CampaignTarget : Object
Task : 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
Params

  • [acl] Array.<string> | function = - limit api to array of groups or use auth function
 

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

Add tasks to process by queue

Kind: instance method of Notifications
Params

 

notifications.subscribe(senderId, pageId, tag)

Subscribe user under certain tag

Kind: instance method of Notifications
Params

  • 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
Params

  • 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
Params

  • event Object
  • pageId string
 

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

Run the campaign now (push tasks into the queue)

Kind: instance method of Notifications
Params

  • 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
Params

  • 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

Params

  • notificationStorage NotificationsStorage
  • options Object
    • [.log] console - logger
    • [.sendMoreMessagesOver24] boolean - use true to disable the 24h window check
    • [.default24Clearance] number - use this clearance to ensure delivery in 24h
 

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
 

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
id string
pageId string
senderId string
campaignId string
enqueue number
[read] number
[delivery] number
[sent] number
[insEnqueue] number

results matching ""

    No results matching ""