Messenger Platform App Review

I found that the app review process of Facebook Messenger’s platform a little confusing while I was working on a side project. The documentation briefly goes over app review but based on my confusion and that of the people in the developer group, I figure I should clear this up once.

The problem was that I created a chat bot and while I can chat with it, other users couldn’t. Their messages were not triggering a webhook that responds to their messages. I had added the “pages_messaging” permission, but that’s not enough. In order for normal users to chat with my Messenger platform app, the app needed to be made public and reviewed by facebook.

app review

The first step is to go to the “App Review” section and provide all the information (including a video of how the app is used).  Set your app as public. If you’re like me, you still won’t be able to “Submit for review” because of this message:

You do not have any platforms eligible for review.

add a platform

To fix this, go to the Settings page and click on the link to add a platform. Notice there’s no Messenger Platform yet. Instead, choose “website” as a platform and provide it with a URL. I used a github page URL and it got approved, so I’m assuming that’s okay.

Once a platform is added, you’ll see the “Submit for Review” function is enabled, so hit that button and wait for someone to review your app. When the app is reviewed, users who are not developer or test roles should be able to chat with your Messenger Platform app.

Alias a route in Rails

Once in a while, I want a route but don’t want to change the controller name or any actual filenames. Route alias to the rescue. If I have a controller called ‘children’ but want a route called ‘kids’ so I can have a url like /kids/1234 then I would add this to my routes file:

resources :children, path: 'kids'

The only caveat is that your route helpers should still refer to the resource, so children_path(), not kids_path().

JSON keys as symbols instead of strings in Ruby

Here’s a quickie that saved me from having to write a recursive symbolize_keys method.  I was dealing with stringified JSON in the params of one of my rails controllers.  I wanted to do the usual call to params[:foo], but when I did JSON.parse  on the string, the keys were strings instead of symbols, so I would need to do params[‘foo’] instead.  Luckily, as of Ruby 1.9, it’s possible to pass in symbolize_names: true as an option.

s = '{"hello": "kitty", "mickey": "mouse"}'
=> "{\"hello\": \"kitty\", \"mickey\": \"mouse\"}"

JSON.parse(s)
=> {"hello"=>"kitty", "mickey"=>"mouse"}

JSON.parse(s, symbolize_names: true)
=> {:hello=>"kitty", :mickey=>"mouse"}