Glitch with Facebook Bot Messenger


I am new to Glitch, I am facing issue with Bot messenger. When I try to send message using PSID. Its giving

message:"(#100) No matching user found"

My Code:

sendTextMessage(, “Postback called”);

function sendTextMessage(recipientId, messageText) {
var messageData = {
recipient: {
id: recipientId
message: {
text: messageText


function callSendAPI(messageData) {
uri: ‘’,
qs: { access_token: process.env.PAGE_ACCESS_TOKEN },
method: ‘POST’,
json: messageData

}, function (error, response, body) {
if (!error && response.statusCode == 200) {
var recipientId = body.recipient_id;
var messageId = body.message_id;

  console.log("Successfully sent generic message with id %s to recipient %s", 
    messageId, recipientId);
} else {
  console.error("Unable to send message.");


Kindly help me to resole this issue


A few things to check are that your api keys are valid and you’re subscribed to the right page and that you’re using the same page-scoped access token to send the message that was used when you received the PSID.


Thanks Garth,

Where we need to use api keys

I am subscribed to right page

Subscribed pages: HelixDemo

page-scoped access token - Yes


I took same code from

In this I added

event.game_play - will be tigger when close Instant game.

This is been get triggered correctly. When I try to send “Thanks” message using PSID I am getting above error.


Hi @Gareth ,
Any update.
My requirement is to send Thanks message after playing instant game.


In that case, you want to make sure you’re subscribed to all of the correct webhook events - under Webhook select ‘edit Events’ and select all the necessary Page Subscription Fields (select all if you’re unsure while in development). Then generate a new Page token and update the .env file in Glitch with it. Make sure the page you’re subscribed to is the same one you’re generating a token for.


Thanks @Gareth, I will do the same and get back to you if any issue.


Hi @Gareth,

I had addded all events

Selected events: messages, messaging_postbacks, messaging_optins, message_deliveries, message_reads, messaging_payments, messaging_pre_checkouts, messaging_checkout_updates, messaging_account_linking, messaging_referrals, message_echoes, messaging_game_plays, standby, messaging_handovers, messaging_policy_enforcement

and generate new Page Access Token.

Still I am getting same error.


Pls explain me where and how to use App Secret. Is it necessary to use it?


The only way I was able to reproduce your error was when I didn’t have all needed permissions set, or I was using an old Page Token created prior to specifying the full permissions.

App Secret isn’t needed for this app. You only need to generate a Page Token for the same page you’ve created a webhook for and have subscribed to and add it to PAGE_ACCESS_TOKEN in .env on Glitch. As well as a user-created ‘verify’ token which can be any string you make up. It needs to match on both Facebook and in the VERIFY_TOKEN value .env on Glitch.



app.get('/webhook', (req, res)

Is not getting triggered, Is there any reason?


When specifying the webhook URL did you provide your Glitch URL appended with /webhook?


This is the Callback URL I have given.


It looks like you have the debugger enabled. Try disabling it and trying again.


Sorry Mr. @Gareth, I am getting same error after disable debugger.


Sorry to hear that. I tried remixing your exact app and it’s working fine for me. This confirms that it isn’t a problem with Glitch or the code used, it’s a setup problem. I suggest you walk through the setup steps again and ensure you’ve followed them correctly:

Create the app on Facebook, add your verify token to the .env file on Glitch and register the ‘Page’ type webhook using the verify token on Facebook (setting the webhook url to the Glitch one with ‘/webhook’ on the end). Then add messenger to your app on Facebook, edit the webhook permissions to include all actions and subscribe to your Facebook page. Generate a page token for that same page and copy and paste the page token into the .env file. Then send a message to your Facebook page to test.