You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with one signal push notifications in ionic everything is alright i have seen my code the app ids , firebase, rest api keys, api urls everything is alright even my code i have tested it , it works but somehow from in app when i try to send notifications that part doesn't works it simply returns api error 400 (Bad request).
Steps to reproduce?
1. just click on the send notification to all users and or even specific user it will return the error.
What did you expect to happen?
IT should send the notifcations via app also but it doesnt however from the one signal dashboard i am able to do so.
OneSignal Cordova SDK version
Release 11.5.1
Which platform(s) are affected?
iOS
Android
Relevant log output
private calculateDataSize(data:any):number {
return new Blob([JSON.stringify(data)]).size;
}
sendNotification(
title: string,
msg: string,
data: any = null,
external_id?: string
) {
// checking data size doesn't exceed more than 2048 bytes if(data && this.calculateDataSize(data) > 2048) { return throwError(() => Error('Data Payload Exceeds 2048 bytes limit')) } let body: any = { app_id: environment.onesignal.appId, name: 'ShipSanitor', target_channel: 'push', headings: { en: title }, contents: { en: msg }, small_icon: 'mipmap/ic_launcher_round', large_icon: 'mipmap/ic_launcher_round', android_channel_id: environment.onesignal.android_channel_id, data: data, }; if (external_id) { // specific device or deives body = { ...body, include_aliases: { external_id: external_id, }, }; } else { body = { ...body, included_segments: ['Subscribed Users'], }; } const headers = new HttpHeaders() .set('accept', 'application/json') .set('Content-Type', 'application/json') .set('Authorization', `Basic ${btoa(environment.onesignal.restAPIKey)}`); return this.http.post<any>( environment.onesignal.APIUrl, body, { headers: headers } ) }
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
What happened?
I'm working with one signal push notifications in ionic everything is alright i have seen my code the app ids , firebase, rest api keys, api urls everything is alright even my code i have tested it , it works but somehow from in app when i try to send notifications that part doesn't works it simply returns api error 400 (Bad request).
Steps to reproduce?
What did you expect to happen?
IT should send the notifcations via app also but it doesnt however from the one signal dashboard i am able to do so.
OneSignal Cordova SDK version
Release 11.5.1
Which platform(s) are affected?
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: