Class: Api::V1::SendgridEventsController Deprecated

Inherits:
ActionController::Metal
  • Object
show all
Includes:
AbstractController::Rendering, ActionController::Renderers::All
Defined in:
app/controllers/api/v1/sendgrid_events_controller.rb

Overview

Deprecated.

This endpoint has been replaced by /webhooks/v1/sendgrid

Returns 410 Gone to indicate the endpoint has permanently moved.
SendGrid will see this error and stop retrying.

New endpoint: POST /webhooks/v1/sendgrid

Instance Method Summary collapse

Instance Method Details

#deprecatedvoid

This method returns an undefined value.

Renders 410 Gone for any request to this deprecated endpoint.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/api/v1/sendgrid_events_controller.rb', line 18

def deprecated
  Rails.logger.warn '[SendGrid] Request to deprecated /v1/sendgrid_events endpoint - use /webhooks/v1/sendgrid instead'

  # Report to AppSignal so we know if old webhooks are still configured
  ErrorReporting.warning(
    'SendGrid webhook sent to deprecated endpoint',
    old_endpoint: '/v1/sendgrid_events',
    new_endpoint: '/webhooks/v1/sendgrid',
    remote_ip: request.remote_ip
  )

  self.content_type = 'application/json'
  self.status = :gone # 410
  self.response_body = {
    error: 'endpoint_deprecated',
    message: 'This endpoint has been deprecated. Please update your SendGrid webhook configuration.',
    new_endpoint: '/webhooks/v1/sendgrid'
  }.to_json
end

#process_eventsObject

Keep old action name for any direct references, redirects to deprecated



39
40
41
# File 'app/controllers/api/v1/sendgrid_events_controller.rb', line 39

def process_events
  deprecated
end