Sha256: 1d7db07f1e1dcf19385daf4ac454d0e468edd81338c627ff5f7164c0d141e6d3

Contents?: true

Size: 1.62 KB

Versions: 12

Compression:

Stored size: 1.62 KB

Contents

<div class="container">
  <% if @error.present? %>
    <h3><%= @error.message %></h3>
  <% else %>
    <div class="row">
      <div class="column column-80 column-offset-10">
        <h3>Webhooks initialization:</h3>

        <h5>1. All active subscriptions will be paused</h5>
        <h5>2. Target url will be updated to <%= @target_url %></h5>
        <h5>3. Following subscriptions will be created and activated:</h5>
        <ul>
          <li>Contact's Creation (contact.creation)</li>
          <li>Changing of Contact's Fist Name (contact.propertyChange)</li>
          <li>Contact's Deletion (contact.deletion)</li>
        </ul>

        <pre>
  ::Hubspot.configure do |config|
    config.api_key = { 'hapikey' => ENV['HUBSPOT_DEVELOPER_API_KEY'] }
  end

  app_id = ENV['HUBSPOT_APPLICATION_ID']
  Services::Hubspot::Webhooks::PauseActiveSubscriptions.new(app_id: app_id).call

  target_url = url_for(controller: :webhooks, action: :callback, only_path: false, protocol: 'https')
  Services::Hubspot::Webhooks::ConfigureTargetUrl.new(app_id: app_id, target_url: target_url).call

  subscriptions = [
    {"event_type": "contact.propertyChange", "property_name": "firstname"},
    {"event_type": "contact.creation"},
    {"event_type": "contact.deletion"},
  ]

  subscriptions.each do |subscription|
    Services::Hubspot::Webhooks::CreateOrActivateSubscription.new(app_id: app_id, **subscription).call
  end

  redirect_to controller: :events, action: :index
        </pre>
        <%= form_with(url: "/start", method: "post", local: true) do %>
          <%= submit_tag("Start") %>
        <% end %>
      </div>
    </div>
  <% end %>
</div>

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hubspot-api-client-9.0.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-8.0.1 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-8.0.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-7.3.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-7.2.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-7.1.1 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-7.1.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-7.0.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-6.0.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-5.0.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-4.0.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb
hubspot-api-client-3.3.0 sample-apps/webhooks-contacts-app/app/views/home/index.html.erb