Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

520
Views
OneSignal notification redirect to invalid URL

I have a OneSignal setup for sending notification to specific users via external user id as follows


$fields = [
    'app_id'                        => env( 'app.onesignalAppKey' ),
    'priority'                      => 10, // High priority.
    'include_external_user_ids'     => [ md5( $contact['email'] ) ],
    'channel_for_external_user_ids' => 'push',
    'headings'                      => [ 'en' => $this->subject ],
    'contents'                      => [ 'en' => $this->message ],
    'url'                           => [ 'en' => base_url( $this->args['log_extra']['url'] ) ]
];

$fields = json_encode($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, env( 'app.Onesignalurl'));
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8',
    'Authorization: Basic '. env( 'app.onesignalAPI' )));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch);
curl_close($ch);

While testing I'm receiving notification, but clocking the notification redirect to wrong url.

https://example.com/onesignal/{"en"=>"https://example.com/correct-path"}

OneSignal service worker installed with scope set to /onesignal/

Am I don't something wrong here..?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Just put the URL as string in $fields array, not an array. like:

'url' => base_url( $this->args['log_extra']['url'] ),
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!