Unable to connect lead webhook – webhook.delivery.rejected

Description
I’ve been working on processing leads through our system and encountered an issue. I’ve enabled webhooks on my app, subscribed to leadgen, and provided my callback redirect URL. However, whenever I create a lead, it should be sent to my server, but when I track the status, it shows “failed” with the message “webhook.delivery.rejected.”
I’ve looked in the logs of my application but the request is not entering my server at all. I’m trying to understand why this is happening and how to ensure my configuration is correct for receiving leads.

Previously, I completed the process manually by subscribing to each webhook with a seperate app, and it worked fine. Now, I want to programmatically do this using Facebook’s API and one app. Here’s the request I’m using to subscribe to the webhook for leads:
curl -X POST “https://graph.facebook.com/{page_id}/subscribed_apps?subscribed_fields=leadgen&access_token={page_token}”
-H “Content-Type: application/json”
-d ‘{
“override_callback_uri”: “https://api-development.recrubo.app/facebook/webhooks/{organization_id}”,
“verify_token”: “{verify_token}”
}’

Debugging
Here are my debugging steps so far: I’ve used the Facebook sharing debugger tool with my callback URL, which returns a 200 status. You can check the results here: Debugging Results..

I’ve used the Lead Ads RTU Debug Tool to send a test lead to our server but it isn’t arriving at my server.

Question
Is there any place to see more error logging in the developer app?

Code
The perform method calls all subsequent calls .
It first fetches the user_id which is used to check what pages the user has given us access to.
It then fetches the page_access_tokens for all the accessible pages.
It then loops through the pages and subscribes to the webhooks.

 def perform
  @user_id = get_user_id
  @pages = get_page_access_tokens
  @pages.each do |page|
    @facebook.subscribe_to_webhook(page[:id], page[:token])
    token = @facebook.get_long_lived_access_token(page[:token])
    options = {
      ad_account_id: @ad_account_id
    }

    @access_token ||= @organization.access_tokens.create!(token: token, options: options, name: 'Meta', user_id: @user_id)
  end
  @access_token
end


def get_page_access_tokens(user_id, access_token)
  response = Faraday.get("#{ENV.fetch('FACEBOOK_GRAPH_API')}/#{user_id}/accounts") do |req|
    req.headers['Content-Type'] = 'application/json'
    req.params['access_token'] = access_token
  end

  raise "Unable to get page access token server responded with #{response.body} and status #{response.status}" unless response.success?

  data = JSON.parse(response.body)
  page_data = data['data']
  page_data.map { |page| { id: page['id'], name: page['name'], token: page['access_token'] } }
end

def subscribe_to_webhook(page_id, page_token)
  response = Faraday.post("#{ENV.fetch('FACEBOOK_GRAPH_API')}/#{page_id}/subscribed_apps?subscribed_fields=leadgen") do |req|
    req.headers['Content-Type'] = 'application/json'
    req.params['access_token'] = page_token
    req.body = {
      override_callback_uri: "#{ENV.fetch('API_URL')}/facebook/webhooks/#{@organization['id']}",
      verify_token: {local_token}
    }.to_json
  end

  raise "Unable to subscribe to leadgen webhook server responded with #{response.body} and status #{response.status}" unless response.success?
  response
end

def get_user_id(access_token)
  response = Faraday.get("#{ENV.fetch('FACEBOOK_GRAPH_API')}/me") do |req|
    req.headers['Content-Type'] = 'application/json'
    req.params['fields'] = 'id'
    req.params['access_token'] = access_token
  end

  raise "Unable to get user id server responded with #{response.body} and status #{response.status}" unless response.success?
  JSON.parse(response.body)['id']
end

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật