javascriptfbconnect

Error sending message with FB API


I am doing something for a client and I wanted to test what I had so far by sending a message to the default test user. But it gave an error after I tried here it the function that isnt working...

function sendWithoutTimerFunc()
{   
    try
    {
        FB.ui({
            app_id: '1226220854077249',
            method: 'send',
            link: 'https://developers.facebook.com/apps/1226220854077249/roles/test-users/',
            to: '111526025937966',
            message: 'Hello test user',
            data: '...'
        });
    }
    catch(error)
    {
        alert(error); //Will change to console.log() later
    }
}

Error

This dialog has been passed a bad parameter.

API Error Code: 100
API Error Description: Invalid parameter
Error Message: Viewer cannot message specified recipients.

Solution

  • id 111526025937966 is not a valid facebook id.

    you should use a valid id. i'm not sure but you may able to use your own id too.