TapTalk.io Documentation
  • Introduction
  • OneTalk Omnichannel Documentation
    • Getting Started with OneTalk
      • Team Members
      • Add Topic
      • Assign Agent to Topic
      • Paid Proactive Chat
    • Channel Integration
      • Telegram Integration
      • WhatsApp SME Integration
      • Instagram DM Integration
      • Facebook Messenger Integration
      • Live Chat Integration (iOS, Android, Web)
        • OneTalk Live Chat for Android
          • Get Started
          • Event Listener
          • Authentication
          • Case & Topic
          • Navigate Live Chat UI
          • Customize UI Appearance
        • OneTalk Live Chat for iOS
          • Get Started
          • Background Process in TapTalk.io Omnichannel iOS
          • Event Delegate
          • Authentication
          • Case & Topic
          • Navigate Live Chat UI
          • Customize UI Appearance
        • OneTalk Live Chat for Web
          • Get Started
          • Callback
          • Method
        • OneTalk Live Chat for React Native
          • Get Started - Android
          • Authentication - Android
          • Get Started - iOS
          • Authentication - iOS
        • OneTalk Live Chat for Flutter
          • Get Started - Android
          • Get Started - iOS
      • Google Business Messages Integration
      • Google Business Profile Integration
      • Tokopedia Integration
    • Integration API
      • Inbox API
      • User/Contact API
    • Live Chat Widget Callback Function
    • Social Channel Button
    • Custom Chatbot Integration
      • Get Started
      • Edit or Delete Chatbot
      • Development
    • QnA via API
    • Webhook
  • PowerTalk Chat SDK Documentation
    • Getting Started with PowerTalk
    • PowerTalk Android
      • Get Started
      • Enable Chat Features
      • Authentication
      • TapUI and TapCore
      • Background Process in TapTalk.io
      • Connection
      • Event Listener
      • Push Notification
      • General
      • User
      • Room List
        • Room List - TapUI
        • Room List - TapCore
      • Chat Room and Messages
        • Chat Room and Messages - TapUI
        • Chat Room and Messages - TapCore
      • Contact
      • Message Type
      • Customize UI Appearance
      • Customize Chat Features
      • Customize Chat Message Bubble
      • Customize Navigation Bar
      • Deep Linking
      • Error Codes
    • PowerTalk iOS
      • Get Started
      • TapUI and TapCore
      • Background Process in TapTalk.io
      • Implement Application Delegate
      • Authentication
      • Connection
      • Event Delegate
      • Push Notification
      • General
      • User
      • Room List
        • Room List - TapUI
        • Room List - TapCore
      • Chat Room and Messages
        • Chat Room and Messages - TapUI
        • Chat Room and Messages - TapCore
      • Contact
      • Message Type
      • Customize UI Appearance
      • Customize Chat Features
      • Customize Chat Message Bubble
      • Customize Navigation Bar
      • Deep Linking
      • Error Codes
    • PowerTalk React Native
      • Get Started - Android
      • Get Started - iOS
    • PowerTalk Flutter
      • Get Started - Android
      • Get Started - iOS
    • Javascript SDK
      • Get Started
      • Authentication
      • Connection
      • General
      • Event Listener
      • User
      • Room List
      • Chat Room
      • Messages
      • Contact
      • Message Type
    • Server API
      • Get Started
      • Base URL
      • Authentication
      • User
      • Contact
      • Message
      • Room
    • Webhook
      • Get Started
      • Webhook Payload
  • MeetTalk SDK Documentation
    • Getting Started with MeetTalk
    • MeetTalk Android
      • Get Started
      • Event Listener
    • MeetTalk iOS
      • Get Started
      • Implement Application Delegate
      • Event Delegate
  • SendTalk API Documentation
    • Introduction
    • Whatsapp Verification
Powered by GitBook
On this page
  • Step 1: Generating your .p8 key file
  • Step 2: Using .p8 key file in TapTalk.io dashboard to send push notification
  • Step 3: Implement push notification in your app
  • Add In-App Notification

Was this helpful?

  1. PowerTalk Chat SDK Documentation
  2. PowerTalk iOS

Push Notification

PreviousEvent DelegateNextGeneral

Last updated 1 month ago

Was this helpful?

Push notification is a very important aspect in a chat application. Taptalk.io provides a convenient way to implement push notifications so you can easily manage them according to your needs. If you implement Taptalk.io with the UI implementation method, incoming notifications will be handled within our library and will be automatically shown to the user. If you prefer having full control over the push notifications, the core implementation method can be used.

Push notification for iOS client apps are sent using Apple Push Notification service (APNs). They are used for keeping your users informed with timely and relevant content, whether your client app is running in the background or inactive on a device. They can also perform the types of user interactions such as alert, sound, or badge, and include custom data your app needs to respond to the notifications.

Our iOS SDK enables you to build a client app that can receive push notifications. When a message is sent to TapTalk.io server through the SDK, the server communicates with APNs regarding the message and then APNs delivers a push notification for the message to an iOS device where your client app is installed.

Step 1: Generating your .p8 key file

Configuration with auth keys is recommended as they are the more current method for sending notifications to iOS.

A .p8 key file is required to send push notifications to your apps. There are some several ways to generate key for push notification, but Apple recommends to use APNs Auth Key (.p8 key file) to register for push notifications.

1. To generate a .p8 key file, go to , then select Certificates, IDs & Profiles.

2. Next, select Keys tab.

3. Click "+" button or click Create a key button to add new key.

4. In the new key page, type in your key name and check the Apple Push Notification service (APNs) box, then click Continue.

5. Confirm your key information and click Register.

Then proceed to download the key file by clicking Download.

Please remember the Key ID provided in the information above or you can see the Key ID from the downloaded file. The Auth Key filename will look like this : AuthKey_ABC12DE34.p8, the ABC12DE34 is the Key ID for this key, we will need this Key ID later.

Step 2: Using .p8 key file in TapTalk.io dashboard to send push notification

3. Next, select Add APNs Authentication Key

4. Upload .p8 Authentication Key, add APN Key ID, add Team ID, and select to show unread count option

Show Unread Count

You can choose either to show unread count by chat room or not show unread count

Step 3: Implement push notification in your app

1. The first step is to implement UIApplicationDelegate & TapTalkApplicationDelegate in your AppDelegate class.

AppDelegate.m
@interface AppDelegate () <TapTalkDelegate, UNUserNotificationCenterDelegate>

@end

// Implement didRegisterForRemoteNotificationsWithDeviceToken: method to tells the delegate that the app successfully registered with Apple Push Notification service (APNs).
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    //Call TapTalk didRegisterForRemoteNotificationsWithDeviceToken: method
    [[TapTalk sharedInstance] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

// Implement didReceiveRemoteNotification: method to tells the app that a remote notification arrived that indicates there is data to be fetched.
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
    // Call TapTalk didReceiveRemoteNotification: method
    [[TapTalk sharedInstance] application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}

2. Request authorization to Apple Push Notification Service (APNs) by using this method in your appDelegate class with application:didFinishLaunchingWithOptions: method.

AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  
    //Register for notification in didFinishLaunchingWithOptions: method  
    [UNUserNotificationCenter currentNotificationCenter].delegate = self;
    UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge
      
    [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions completionHandler:^(BOOL granted, NSError * _Nullable error) {
    }];  
}

3. Implement UNUserNotificationCenterDelegate to handle notification in your appDelegate class.

AppDelegate.m
// Add UNUserNotificationCenterDelegate
@interface AppDelegate () <UNUserNotificationCenterDelegate>

@end

@implementation AppDelegate

#pragma mark - UNUserNotificationCenter
// Implement UNUserNotificationCenter delegate
// This method lets the app know when a notification is delivered to foreground
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
    // Add TapTalk.io method to handle willPresentNotification method
    [[TapTalk sharedInstance] userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
}

// This method lets your app know which action was selected by the user for a given notification
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void(^)())completionHandler {
    // Add TapTalk.io method to handle didReceiveNotificationResponse method
    [[TapTalk sharedInstance] userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
}
  
@end

4. Implement TapTalkDelegate in appDelegate class.

AppDelegate.m
// Add TapTalkDelegate and previous UNUserNotificationCenterDelegate
@interface AppDelegate () <UNUserNotificationCenterDelegate, TapTalkDelegate>

@end

@implementation AppDelegate

#pragma mark - Delegate
#pragma mark - TapTalkDelegate

//Implement TapTalk Delegate and add code below
- (void)tapTalkDidRequestRemoteNotification {
    // Register to receive remote notifications via Apple Push Notification service
    [[UIApplication sharedApplication] registerForRemoteNotifications];
}
  
@end

Add In-App Notification

TapTalk.io provides in-app notification handling. This following code enables you to activate and show in-app notification.

AppDelegate.m
#import <TapTalk/TapUI.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // To activate in-app push notification with your current window
    [[TapUI sharedInstance] activateTapTalkInAppNotification:YES];
  
}

Note: You will not receive any in-app notification if you don't implement this method.

1. Go to , and login to your dashboard.Select Tab Development -> Push Certificates 2. Select Tab Development -> Push Certificates

You can find your Team ID in the Apple Member Center under the .

TapTalk.io Dashboard page
membership tab
Apple developer account page