feat: Update instagram webhooks URL (#3197)
This commit is contained in:
parent
c1d68cc8ae
commit
5749d25ff8
3 changed files with 19 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
||||||
class Api::V1::InstagramCallbacksController < ApplicationController
|
class Webhooks::InstagramController < ApplicationController
|
||||||
skip_before_action :authenticate_user!, raise: false
|
skip_before_action :authenticate_user!, raise: false
|
||||||
skip_before_action :set_current_user
|
skip_before_action :set_current_user
|
||||||
|
|
|
@ -256,8 +256,8 @@ Rails.application.routes.draw do
|
||||||
post 'webhooks/line/:line_channel_id', to: 'webhooks/line#process_payload'
|
post 'webhooks/line/:line_channel_id', to: 'webhooks/line#process_payload'
|
||||||
post 'webhooks/telegram/:bot_token', to: 'webhooks/telegram#process_payload'
|
post 'webhooks/telegram/:bot_token', to: 'webhooks/telegram#process_payload'
|
||||||
post 'webhooks/whatsapp/:phone_number', to: 'webhooks/whatsapp#process_payload'
|
post 'webhooks/whatsapp/:phone_number', to: 'webhooks/whatsapp#process_payload'
|
||||||
get 'instagram_callbacks/event', to: 'api/v1/instagram_callbacks#verify'
|
get 'webhooks/instagram', to: 'webhooks/instagram#verify'
|
||||||
post 'instagram_callbacks/event', to: 'api/v1/instagram_callbacks#events'
|
post 'webhooks/instagram', to: 'webhooks/instagram#events'
|
||||||
|
|
||||||
namespace :twitter do
|
namespace :twitter do
|
||||||
resource :callback, only: [:show]
|
resource :callback, only: [:show]
|
||||||
|
|
16
spec/controllers/webhooks/instagram_controller_spec.rb
Normal file
16
spec/controllers/webhooks/instagram_controller_spec.rb
Normal 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
|
Loading…
Reference in a new issue