CTA Callback
2min
Updated 03 Mar 2023
Did this page help you?
Yes
No
Cooee SDK supports callback on any action of in-app notifications actions by returning a map of key-value pairs (i.e. objects in JavaScript). You can check more CTA options on Call to Action page.
To handle callbacks, modify your global code i.e. app.component.ts
import {Component, OnInit} from '@angular/core'; import {CooeeService} from './services/cooee.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], }) export class AppComponent implements OnInit { constructor(private readonly cooeeService: CooeeService) { this.cooeeService.init(); } ngOnInit(): void { // Add this this.cooeeService.onCTA() .subscribe((payload: Record<string, any>) => { if (!payload) return; if (payload.actionType === 'VIEW_ITEM') { // Take the user to the given item's page. Item id will be in "payload.id" } else if (payload.actionType == 'GO_TO_SCREEN') { // Take user to the given screen name } }); } }