How to redirect through a notification?

Asked

Viewed 179 times

3

I’m sending notifications to registered users via Facebook about new events. How do I redirect the user to the event URL, sent via the Facebook API?

private function sendNotification($userFbId, $message, $url){
    $attachment = array(
      'access_token' => Configure::read('fb_id').'|'.Configure::read('fb_secret'),
      'href' => $url, 
      'template' => $message,
    );
    try {
        $api = $this->Facebook->api('/'.$userFbId.'/notifications/', 'POST',  $attachment);
    } catch (Exception $e) {
        $api = $e->getMessage();
    }
    return $api;
}

inserir a descrição da imagem aqui

  • Do you want facebook to redirect the user, after being invited by the notification, to the event on facebook? Check this out: https://developers.facebook.com/policy/

  • Under the $api = (...), if you put header("Location: {$url}"); works?

  • @Lollipop I register an event on the site and send a notification to registered users on it, through Facebook. When sending a notification on Facebook, I want you to redirect the user to the url I report.

  • I think just use friend header by passing the url with the parameters.

1 answer

3


The notification link can only lead to a relative link from the app’s own canvas.

"The relative path/GET params of the target (for example, 'index.html? gift_id=123', or '?gift_id=123')..."
https://developers.facebook.com/docs/games/notifications#impl

And since canvas is an iframe, you can’t even redirect =/

  • So there is how to open the link sent in the notification, within the canvas? IE, within the app on Facebook?

  • That. There in your app’s settings, where you set the canvas URL, you can point to any link within that url as well as pass parameters via get to your canvas index, etc.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.