Phurple\Client::requestAction — Prompts user for an action

public integer Phurple\Client::requestAction( string  title ,
                                              string  primary ,
                                              string  secondary ,
                                              integer  default_action ,
                                              Phurple\Account  account ,
                                              string  who ,
                                              Phurple\Conversation  conv ,
                                              array  actions );

This callback is invoked when some user action is required. In a desktop client it's often represented as a dialog window with buttons for each action. Besides all the other arguments, the last one contains the actions array which is an integer indexed array with action numbers as keys and button names as values. To call one or another action this method has to return the appropriate integer key from the actions array.

Unfortunately there's almost no reliable way to programmatically determine which action axactly is requested. The popup dialog a desktop user would see would present the title, primary and secondary in a readable way so user could react correspondingly. So there are two work arounds for this - parse that data and check for certain content. Or, if your script is supposed to just do a limited set on functionality, you could record the values come in for the action requests you expect and hardcode the return values. That's the nature of libpurple, so nothing to do about it in PHP.