Examples: Events methods with content offers

From Genesys Documentation
Jump to: navigation, search

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!