Class: HubSpotSDK::Resources::Marketing::MarketingEvents

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/marketing/marketing_events.rb,
lib/hubspot_sdk/resources/marketing/marketing_events/events.rb,
lib/hubspot_sdk/resources/marketing/marketing_events/settings.rb,
lib/hubspot_sdk/resources/marketing/marketing_events/attendance.rb,
lib/hubspot_sdk/resources/marketing/marketing_events/participations.rb,
lib/hubspot_sdk/resources/marketing/marketing_events/subscriber_state.rb,
lib/hubspot_sdk/resources/marketing/marketing_events/list_associations.rb

Defined Under Namespace

Classes: Attendance, Events, ListAssociations, Participations, Settings, SubscriberState

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ MarketingEvents

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MarketingEvents.

Parameters:



497
498
499
500
501
502
503
504
505
506
507
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 497

def initialize(client:)
  @client = client
  @attendance = HubSpotSDK::Resources::Marketing::MarketingEvents::Attendance.new(client: client)
  @events = HubSpotSDK::Resources::Marketing::MarketingEvents::Events.new(client: client)
  @list_associations =
    HubSpotSDK::Resources::Marketing::MarketingEvents::ListAssociations.new(client: client)
  @participations = HubSpotSDK::Resources::Marketing::MarketingEvents::Participations.new(client: client)
  @settings = HubSpotSDK::Resources::Marketing::MarketingEvents::Settings.new(client: client)
  @subscriber_state =
    HubSpotSDK::Resources::Marketing::MarketingEvents::SubscriberState.new(client: client)
end

Instance Attribute Details

#attendanceHubSpotSDK::Resources::Marketing::MarketingEvents::Attendance (readonly)



8
9
10
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 8

def attendance
  @attendance
end

#eventsHubSpotSDK::Resources::Marketing::MarketingEvents::Events (readonly)



11
12
13
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 11

def events
  @events
end

#list_associationsHubSpotSDK::Resources::Marketing::MarketingEvents::ListAssociations (readonly)



14
15
16
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 14

def list_associations
  @list_associations
end

#participationsHubSpotSDK::Resources::Marketing::MarketingEvents::Participations (readonly)



17
18
19
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 17

def participations
  @participations
end

#settingsHubSpotSDK::Resources::Marketing::MarketingEvents::Settings (readonly)



20
21
22
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 20

def settings
  @settings
end

#subscriber_stateHubSpotSDK::Resources::Marketing::MarketingEvents::SubscriberState (readonly)



23
24
25
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 23

def subscriber_state
  @subscriber_state
end

Instance Method Details

#create(custom_properties:, event_name:, event_organizer:, external_account_id:, external_event_id:, end_date_time: nil, event_cancelled: nil, event_completed: nil, event_description: nil, event_type: nil, event_url: nil, start_date_time: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::MarketingEventDefaultResponse

Some parameter documentations has been truncated, see Models::Marketing::MarketingEventCreateParams for more details.

Creates a new marketing event in HubSpot

Parameters:

  • custom_properties (Array<HubSpotSDK::Models::PropertyValue>)

    A list of PropertyValues. These can be whatever kind of property names and value

  • event_name (String)

    The name of the marketing event.

  • event_organizer (String)

    The name of the organizer of the marketing event.

  • external_account_id (String)

    The accountId that is associated with this marketing event in the external event

  • external_event_id (String)

    The id of the marketing event in the external event application.

  • end_date_time (Time)

    The end date and time of the marketing event.

  • event_cancelled (Boolean)

    Indicates if the marketing event has been cancelled. Defaults to ‘false`

  • event_completed (Boolean)

    Indicates if the marketing event has been completed. Defaults to ‘false`

  • event_description (String)

    The description of the marketing event.

  • event_type (String)

    Describes what type of event this is. For example: ‘WEBINAR`, `CONFERENCE`, `WO

  • event_url (String)

    A URL in the external event application where the marketing event can be managed

  • start_date_time (Time)

    The start date and time of the marketing event.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 61

def create(params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/marketing-events/2026-03/events",
    body: parsed,
    model: HubSpotSDK::Marketing::MarketingEventDefaultResponse,
    options: options
  )
end

#delete(object_id_, request_options: {}) ⇒ nil

Deletes the existing Marketing Event with the specified objectId, if it exists.

Parameters:

  • object_id_ (String)

    The internal id of the marketing event in HubSpot.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



151
152
153
154
155
156
157
158
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 151

def delete(object_id_, params = {})
  @client.request(
    method: :delete,
    path: ["marketing/marketing-events/2026-03/%1$s", object_id_],
    model: NilClass,
    options: params[:request_options]
  )
end

#delete_batch(inputs:, request_options: {}) ⇒ StringIO

Deletes multiple Marketing Events from the portal based on their objectId, if they exist.

Responses: 204: Returned if all specified Marketing Events were successfully deleted. 207: Returned if some objectIds did not correspond to any existing Marketing Events.

Parameters:

Returns:

  • (StringIO)

See Also:



175
176
177
178
179
180
181
182
183
184
185
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 175

def delete_batch(params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventDeleteBatchParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/marketing-events/2026-03/batch/archive",
    headers: {"accept" => "*/*"},
    body: parsed,
    model: StringIO,
    options: options
  )
end

#delete_batch_by_external_event_id(inputs:, request_options: {}) ⇒ StringIO

Deletes multiple Marketing Events based on externalAccountId, externalEventId, and appId.

Only Marketing Events created by the same apps will be deleted; events from other apps cannot be removed by this endpoint.



201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 201

def delete_batch_by_external_event_id(params)
  parsed, options =
    HubSpotSDK::Marketing::MarketingEventDeleteBatchByExternalEventIDParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/marketing-events/2026-03/events/delete",
    headers: {"accept" => "*/*"},
    body: parsed,
    model: StringIO,
    options: options
  )
end

#delete_by_external_event_id(external_event_id, external_account_id:, request_options: {}) ⇒ nil

Deletes the existing Marketing Event with the specified externalAccountId, externalEventId, if it exists.

Only Marketing Events created by the same app can be deleted.

Parameters:

Returns:

  • (nil)

See Also:



228
229
230
231
232
233
234
235
236
237
238
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 228

def delete_by_external_event_id(external_event_id, params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventDeleteByExternalEventIDParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :delete,
    path: ["marketing/marketing-events/2026-03/events/%1$s", external_event_id],
    query: query.transform_keys(external_account_id: "externalAccountId"),
    model: NilClass,
    options: options
  )
end

#get(object_id_, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::MarketingEventPublicReadResponseV2

Returns the details of a Marketing Event with the specified objectId, if it exists.

Parameters:

  • object_id_ (String)

    The internal id of the marketing event in HubSpot.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



252
253
254
255
256
257
258
259
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 252

def get(object_id_, params = {})
  @client.request(
    method: :get,
    path: ["marketing/marketing-events/2026-03/%1$s", object_id_],
    model: HubSpotSDK::Marketing::MarketingEventPublicReadResponseV2,
    options: params[:request_options]
  )
end

#get_by_external_event_id(external_event_id, external_account_id:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::MarketingEventPublicReadResponse

Returns the details of a Marketing Event with the specified externalAccountId, externalEventId, if it exists.

Only Marketing Events created by the same app making the request can be retrieved.

Parameters:

Returns:

See Also:



276
277
278
279
280
281
282
283
284
285
286
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 276

def get_by_external_event_id(external_event_id, params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventGetByExternalEventIDParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["marketing/marketing-events/2026-03/events/%1$s", external_event_id],
    query: query.transform_keys(external_account_id: "externalAccountId"),
    model: HubSpotSDK::Marketing::MarketingEventPublicReadResponse,
    options: options
  )
end

#list(after: nil, limit: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Marketing::MarketingEventPublicReadResponseV2>

Parameters:

  • after (String)

    The cursor indicating the position of the last retrieved item.

  • limit (Integer)

    The limit for response size. The default value is 10, the max number is 100

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 127

def list(params = {})
  parsed, options = HubSpotSDK::Marketing::MarketingEventListParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "marketing/marketing-events/2026-03",
    query: query,
    page: HubSpotSDK::Internal::Page,
    model: HubSpotSDK::Marketing::MarketingEventPublicReadResponseV2,
    options: options
  )
end

#search_by_external_event_id(q:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::CollectionResponseSearchPublicResponseWrapperNoPaging

Retrieves Marketing Events where the externalEventId matches the value provided in the request, limited to events created by the app making the request.

Marketing Events created by other apps will not be included in the results.



301
302
303
304
305
306
307
308
309
310
311
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 301

def search_by_external_event_id(params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventSearchByExternalEventIDParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "marketing/marketing-events/2026-03/events/search",
    query: query,
    model: HubSpotSDK::Marketing::CollectionResponseSearchPublicResponseWrapperNoPaging,
    options: options
  )
end

#search_identifiers_by_external_event_id(external_event_id, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::CollectionResponseWithTotalMarketingEventIdentifiersResponse

This endpoint searches the portal for all Marketing Events whose externalEventId matches the value provided in the request.

It retrieves the objectId and additional event details for each matching Marketing Event.

Since multiple Marketing Events can have the same externalEventId, the endpoint returns all matching results.

Note: Marketing Events become searchable by externalEventId a few minutes after creation.

Parameters:

  • external_event_id (String)

    The id of the marketing event in the external event application.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



334
335
336
337
338
339
340
341
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 334

def search_identifiers_by_external_event_id(external_event_id, params = {})
  @client.request(
    method: :get,
    path: ["marketing/marketing-events/2026-03/%1$s/identifiers", external_event_id],
    model: HubSpotSDK::Marketing::CollectionResponseWithTotalMarketingEventIdentifiersResponse,
    options: params[:request_options]
  )
end

#update(object_id_, custom_properties:, end_date_time: nil, event_cancelled: nil, event_description: nil, event_name: nil, event_organizer: nil, event_type: nil, event_url: nil, start_date_time: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::MarketingEventPublicDefaultResponseV2

Some parameter documentations has been truncated, see Models::Marketing::MarketingEventUpdateParams for more details.

Updates the details of an existing Marketing Event identified by its objectId, if it exists.

Parameters:

  • object_id_ (String)

    The internal id of the marketing event in HubSpot.

  • custom_properties (Array<HubSpotSDK::Models::PropertyValue>)
  • end_date_time (Time)

    The end date and time of the marketing event

  • event_cancelled (Boolean)

    Indicates if the marketing event has been cancelled

  • event_description (String)

    The description of the marketing event

  • event_name (String)

    The name of the marketing event

  • event_organizer (String)

    The name of the organizer of the marketing event

  • event_type (String)

    The type of the marketing event

  • event_url (String)

    A URL in the external event application where the marketing event can be managed

  • start_date_time (Time)

    The start date and time of the marketing event

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



105
106
107
108
109
110
111
112
113
114
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 105

def update(object_id_, params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["marketing/marketing-events/2026-03/%1$s", object_id_],
    body: parsed,
    model: HubSpotSDK::Marketing::MarketingEventPublicDefaultResponseV2,
    options: options
  )
end

#update_batch(inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::BatchResponseMarketingEventPublicDefaultResponseV2

Updates multiple Marketing Events on the portal based on their objectId, if they exist.



354
355
356
357
358
359
360
361
362
363
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 354

def update_batch(params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventUpdateBatchParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/marketing-events/2026-03/batch/update",
    body: parsed,
    model: HubSpotSDK::Marketing::BatchResponseMarketingEventPublicDefaultResponseV2,
    options: options
  )
end

#update_by_external_event_id(external_event_id, external_account_id:, custom_properties:, end_date_time: nil, event_cancelled: nil, event_completed: nil, event_description: nil, event_name: nil, event_organizer: nil, event_type: nil, event_url: nil, start_date_time: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::MarketingEventPublicDefaultResponse

Some parameter documentations has been truncated, see Models::Marketing::MarketingEventUpdateByExternalEventIDParams for more details.

Updates the details of an existing Marketing Event identified by its externalAccountId, externalEventId if it exists.

Only Marketing Events created by the same app can be updated.

Parameters:

  • external_event_id (String)

    Path param

  • external_account_id (String)

    Query param

  • custom_properties (Array<HubSpotSDK::Models::PropertyValue>)

    Body param: A list of PropertyValues. These can be whatever kind of property nam

  • end_date_time (Time)

    Body param: The end date and time of the marketing event.

  • event_cancelled (Boolean)

    Body param: Indicates if the marketing event has been cancelled. Defaults to ‘fa

  • event_completed (Boolean)

    Body param: Indicates if the marketing event has been completed. Defaults to ‘fa

  • event_description (String)

    Body param: The description of the marketing event.

  • event_name (String)

    Body param: The name of the marketing event.

  • event_organizer (String)

    Body param: The name of the organizer of the marketing event.

  • event_type (String)

    Body param: Describes what type of event this is. For example: ‘WEBINAR`, `CONF

  • event_url (String)

    Body param: A URL in the external event application where the marketing event ca

  • start_date_time (Time)

    Body param: The start date and time of the marketing event.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 405

def update_by_external_event_id(external_event_id, params)
  query_params = [:external_account_id]
  parsed, options = HubSpotSDK::Marketing::MarketingEventUpdateByExternalEventIDParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :patch,
    path: ["marketing/marketing-events/2026-03/events/%1$s", external_event_id],
    query: query.transform_keys(external_account_id: "externalAccountId"),
    body: parsed.except(*query_params),
    model: HubSpotSDK::Marketing::MarketingEventPublicDefaultResponse,
    options: options
  )
end

#upsert_batch(inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::BatchResponseMarketingEventPublicDefaultResponse

Upserts multiple Marketing Events. If a Marketing Event with the specified ID already exists, it will be updated; otherwise, a new event will be created.

Only Marketing Events originally created by the same app can be updated.



432
433
434
435
436
437
438
439
440
441
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 432

def upsert_batch(params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventUpsertBatchParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/marketing-events/2026-03/events/upsert",
    body: parsed,
    model: HubSpotSDK::Marketing::BatchResponseMarketingEventPublicDefaultResponse,
    options: options
  )
end

#upsert_by_external_event_id(path_external_event_id, custom_properties:, event_name:, event_organizer:, external_account_id:, body_external_event_id:, end_date_time: nil, event_cancelled: nil, event_completed: nil, event_description: nil, event_type: nil, event_url: nil, start_date_time: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::MarketingEventPublicDefaultResponse

Some parameter documentations has been truncated, see Models::Marketing::MarketingEventUpsertByExternalEventIDParams for more details.

Upserts a marketing event If there is an existing marketing event with the specified ID, it will be updated; otherwise a new event will be created.

Parameters:

  • path_external_event_id (String)
  • custom_properties (Array<HubSpotSDK::Models::PropertyValue>)

    A list of PropertyValues. These can be whatever kind of property names and value

  • event_name (String)

    The name of the marketing event.

  • event_organizer (String)

    The name of the organizer of the marketing event.

  • external_account_id (String)

    The accountId that is associated with this marketing event in the external event

  • body_external_event_id (String)

    The id of the marketing event in the external event application.

  • end_date_time (Time)

    The end date and time of the marketing event.

  • event_cancelled (Boolean)

    Indicates if the marketing event has been cancelled. Defaults to ‘false`

  • event_completed (Boolean)

    Indicates if the marketing event has been completed. Defaults to ‘false`

  • event_description (String)

    The description of the marketing event.

  • event_type (String)

    Describes what type of event this is. For example: ‘WEBINAR`, `CONFERENCE`, `WO

  • event_url (String)

    A URL in the external event application where the marketing event can be managed

  • start_date_time (Time)

    The start date and time of the marketing event.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



483
484
485
486
487
488
489
490
491
492
# File 'lib/hubspot_sdk/resources/marketing/marketing_events.rb', line 483

def upsert_by_external_event_id(path_external_event_id, params)
  parsed, options = HubSpotSDK::Marketing::MarketingEventUpsertByExternalEventIDParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["marketing/marketing-events/2026-03/events/%1$s", path_external_event_id],
    body: parsed,
    model: HubSpotSDK::Marketing::MarketingEventPublicDefaultResponse,
    options: options
  )
end