As http://gomoob.github.io/php-pushwoosh/create-targeted-message.html

created a function like this

public function pushNotificationToTeacher(){

   $push_conn = Pushwoosh::create()
    ->setApplication('APPLICATION-ID')
    ->setAuth('MY-TOKEN');

$request = CreateTargetedMessageRequest::create()
->setContent(['en' => 'English'])
->setDevicesFilter('A(\"APPLICATION-ID\") * T(\"teacher\")');

$response = $push_conn->createTargetedMessage($request);

}

-------------------------------------------------------------->

And the response i get is "API token or application is not set"

What is wrong ? My token and application id are correct. I used them in "createMessage" function and it works fine.

pls help ...

asked 06 May '16, 10:10
wankwongho's gravatar image

wankwongho
12

edited 06 May '16, 15:53

XXXX's gravatar image

XXXX
2.2k6

Hi. This bug in gomood library. I create pull request for this https://github.com/gomoob/php-pushwoosh/pull/47 . You can apply patch now or subscribe for issue and update lib when patch will be applied.

permanent link
answered 06 May '16, 15:55
XXXX's gravatar image

XXXX
2.2k6

edited 06 May '16, 15:56

Patch applied. Now you can try (setAuth must be added for CreateTargetedMessage request)

public function pushNotificationToTeacher(){
    $push_conn = Pushwoosh::create()
    ->setApplication('APPLICATION-ID');

    $request = CreateTargetedMessageRequest::create()
    ->setAuth('MY-TOKEN')
    ->setContent(['en' => 'English'])
    ->setDevicesFilter('A(\"APPLICATION-ID\") * T(\"teacher\")');

    $response = $push_conn->createTargetedMessage($request);
}
permanent link
answered 10 May '16, 07:25
XXXX's gravatar image

XXXX
2.2k6

edited 10 May '16, 07:29

I have the same problem and I get this message from the script: Oups, the sent failed :-(Status code : 210Status message : API token or application is not set

permanent link
answered 26 May '16, 16:33
ies21's gravatar image

ies21
111

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×353
×326
×33
×1

question asked: 06 May '16, 10:10

question was seen: 1,115 times

last updated: 26 May '16, 16:33