Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: Unable to push notifications to users within segment #18

Open
Labels
@iAmWillShepherd

Description

@iAmWillShepherd

What happened?

I built the following sample app to push notifications to all users within a segment, but unfortunately, I was unable to get it to work.

require'dotenv/load'require'time'require'onesignal'rest_api_key=ENV['ONESIGNAL_REST_API_KEY']app_id=ENV['ONESIGNAL_APP_ID']OneSignal.configuredo |config|config.app_key=rest_api_keyendapi_instance=OneSignal::DefaultApi.newbeginnotification=OneSignal::Notification.new({app_id:app_id})notification.contents=OneSignal::StringMap.new({"en":'English Message'})notification.included_segments=['Include_segment']pnotificationnotification_response=api_instance.create_notification(notification)notification_id=notification_response.idpnotification_responserescueOneSignal::ApiError=>eputs"Error when calling DefaultApi->create_notification:#{e}"end

FWIW,@jmadler and I did a little debugging to confirm that my segment did indeed have users who were subscribed to push, but still got the same error. I also tried several different apps and other segments and got the same results.

Steps to reproduce?

1. Change the`rest_api_key` and`app_id` to an app that makes use of segments2. Run the script I shared3. Note that you receive`All included players are not subscribed` as an error message

What did you expect to happen?

I expected a push notification to be sent to my device.

Relevant log output

#<OneSignal::Notification:0x00000001072d9440 @is_ios=true, @app_id="8152db8f-1417-48a4-b8db-264a744b87a3", @contents=#<OneSignal::StringMap:0x00000001072d9170 @en="English Message">, @included_segments=["Subscribed Users"]>#<OneSignal::InlineResponse200:0x0000000107430bb8 @id="", @recipients=0, @errors=["All included players are not subscribed"]>

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp