feat: Update instagram webhooks URL (#3197)

This commit is contained in:
Tejaswini Chile 2021-10-12 12:46:27 +05:30 committed by GitHub
parent c1d68cc8ae
commit 5749d25ff8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 3 deletions

View file

@ -1,4 +1,4 @@
class Api::V1::InstagramCallbacksController < ApplicationController
class Webhooks::InstagramController < ApplicationController
skip_before_action :authenticate_user!, raise: false
skip_before_action :set_current_user

View file

@ -256,8 +256,8 @@ Rails.application.routes.draw do
post 'webhooks/line/:line_channel_id', to: 'webhooks/line#process_payload'
post 'webhooks/telegram/:bot_token', to: 'webhooks/telegram#process_payload'
post 'webhooks/whatsapp/:phone_number', to: 'webhooks/whatsapp#process_payload'
get 'instagram_callbacks/event', to: 'api/v1/instagram_callbacks#verify'
post 'instagram_callbacks/event', to: 'api/v1/instagram_callbacks#events'
get 'webhooks/instagram', to: 'webhooks/instagram#verify'
post 'webhooks/instagram', to: 'webhooks/instagram#events'
namespace :twitter do
resource :callback, only: [:show]

View file

@ -0,0 +1,16 @@
require 'rails_helper'
RSpec.describe 'Webhooks::InstagramController', type: :request do
describe 'POST /webhooks/instagram' do
let!(:dm_params) { build(:instagram_message_create_event).with_indifferent_access }
it 'call the instagram events job with the params' do
allow(::Webhooks::InstagramEventsJob).to receive(:perform_later)
expect(::Webhooks::InstagramEventsJob).to receive(:perform_later)
instagram_params = dm_params.merge(object: 'instagram')
post '/webhooks/instagram', params: instagram_params
expect(response).to have_http_status(:success)
end
end
end