Difference between revisions of "ATC/Current/SDK/Use Events methods with content offers"

From Genesys Documentation
Jump to: navigation, search
m (Text replacement - "\|Platforms?=([^\|]*)PureEngage([\|]*)" to "|Platform=$1GenesysEngage-onpremises$2")
m (Text replacement - "Genesys Cloud" to "Genesys Cloud CX")
 
(6 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
|DisplayName=Examples: Events methods with content offers
 
|DisplayName=Examples: Events methods with content offers
 
|TocName=Content offers examples
 
|TocName=Content offers examples
|Context=See examples how how to use Events methods with content offers.
+
|Context=See examples of how to use Events methods with content offers.
 
|Dimension=WebActions
 
|Dimension=WebActions
 
|ComingSoon=No
 
|ComingSoon=No
|Platform=GenesysEngage-onpremises, PureConnect, PureCloud
+
|Platform=PureConnect, GenesysCloud, GenesysEngage-cloud
|Prereq=
 
 
|Section={{Section
 
|Section={{Section
 +
|alignment=Vertical
 +
|structuredtext={{NoteFormat|1=This article only applies to customers using {{Link-AnywhereElse|product=ATC|version=Current|manual=AdminGuide|topic=About_web_chats|display text=web chat}}. If you are a Genesys Cloud CX customer, we encourage you to use the new {{Link-AnywhereElse|product=ATC|version=Current|manual=AdminGuide|topic=About_web_messaging|display text=web messaging}} feature to replace web chat.|2=}}<br />
 +
|Status=No
 +
}}{{Section
 
|sectionHeading=Subscribe to offered events
 
|sectionHeading=Subscribe to offered events
 
|anchor=COOffered
 
|anchor=COOffered
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('on', 'contentoffer:offered', (event) => {
 
ac('on', 'contentoffer:offered', (event) => {
Line 20: Line 21:
 
   
 
   
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 27: Line 26:
 
|anchor=COAccepted
 
|anchor=COAccepted
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('on', 'contentoffer:accepted', (event) => {
 
ac('on', 'contentoffer:accepted', (event) => {
Line 34: Line 31:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 41: Line 36:
 
|anchor=CORejected
 
|anchor=CORejected
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('on', 'contentoffer:rejected', (event) => {
 
ac('on', 'contentoffer:rejected', (event) => {
Line 48: Line 41:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 55: Line 46:
 
|anchor=COIgnored
 
|anchor=COIgnored
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('on', 'contentoffer:ignored', (event) => {
 
ac('on', 'contentoffer:ignored', (event) => {
Line 62: Line 51:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 69: Line 56:
 
|anchor=COErrored
 
|anchor=COErrored
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('on', 'contentoffer:errored', (event) => {
 
ac('on', 'contentoffer:errored', (event) => {
Line 76: Line 61:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 83: Line 66:
 
|anchor=COAll
 
|anchor=COAll
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('on', 'contentoffer:all', (event) => {
 
ac('on', 'contentoffer:all', (event) => {
Line 90: Line 71:
 
});
 
});
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}{{Section
 
}}{{Section
Line 97: Line 76:
 
|anchor=COUnsubscribe
 
|anchor=COUnsubscribe
 
|alignment=Vertical
 
|alignment=Vertical
|Media=
 
|image=
 
 
|structuredtext=<syntaxhighlight lang="javascript">
 
|structuredtext=<syntaxhighlight lang="javascript">
 
ac('off', 'contentoffer:offered', eventHandler); // unsubscribes `eventHandler` from 'contentoffer:offered' events
 
ac('off', 'contentoffer:offered', eventHandler); // unsubscribes `eventHandler` from 'contentoffer:offered' events
 
</syntaxhighlight>
 
</syntaxhighlight>
|structuredtextwide=
 
|FAQHeading=
 
 
|Status=No
 
|Status=No
 
}}
 
}}
 
}}
 
}}

Latest revision as of 21:28, November 9, 2021

This topic is part of the manual Journey JavaScript SDK for version Current of Genesys Predictive Engagement.

See examples of how to use Events methods with content offers.

Important
This article only applies to customers using web chat. If you are a Genesys Cloud CX customer, we encourage you to use the new web messaging feature to replace web chat.

Subscribe to offered events

ac('on', 'contentoffer:offered', (event) => {
  console.log('received %s:%s event', event.actionMediaType, event.actionState, event);
});

Subscribe to accepted events

ac('on', 'contentoffer:accepted', (event) => {
  console.log('received %s:%s event', event.actionMediaType, event.actionState, event);
});

Subscribe to rejected events

ac('on', 'contentoffer:rejected', (event) => {
  console.log('received %s:%s event', event.actionMediaType, event.actionState, event);
});

Subscribe to ignored events

ac('on', 'contentoffer:ignored', (event) => {
  console.log('received %s:%s event', event.actionMediaType, event.actionState, event);
});

Subscribe to errored events

ac('on', 'contentoffer:errored', (event) => {
  console.log('received %s:%s event', event.actionMediaType, event.actionState, event);
});

Subscribe to all content offer events

ac('on', 'contentoffer:all', (event) => {
  console.log('received %s:%s event', event.actionMediaType, event.actionState, event);
});

Unsubscribe from content offers in the offered state

ac('off', 'contentoffer:offered', eventHandler); // unsubscribes `eventHandler` from 'contentoffer:offered' events
Comments or questions about this documentation? Contact us for support!