Add contacts to campaigns and submit events

Prev Next

 Backend and CRM systems can activate Elaine in two principal ways: add or update a contact and place that contact into a defined campaign, or submit a business event that Elaine routes asynchronously to subscribed automations and transactional messages.

Choose the activation pattern

                                                                                     
PatternUse it whenPrimary function
Direct campaign subscriptionThe calling system knows the target Elaine campaign and needs the contact placed into it.api_userCreateOrUpdateStartCampaign or api_userStartCampaign
Generic event submissionThe source system should report what happened while Elaine decides which automations or messages consume the event.api_processEvent

Create or update a contact and start a campaign

 api_userCreateOrUpdateStartCampaign accepts the contact data and campaign ID in one call. The optional entry state, restart behavior, force flag, rollback metadata, and data-source ID follow as positional parameters.

export ELAINE_BASE_URL="https://your-elaine-domain.example"
export ELAINE_JWT="replace-with-an-elaine-issued-jwt"

curl --get "$ELAINE_BASE_URL/http/api/api_userCreateOrUpdateStartCampaign" \
  --header "Authorization: Bearer $ELAINE_JWT" \
  --data-urlencode 'json=[{"c_email":"recipient@example.com","c_firstname":"Sam","c_customer_id":"CRM-1001"},42,null,false,false,"api",1001,7]' \
  --data-urlencode 'response=json'

 Here, 42 is the campaign ID, 1001 is an external rollback or correlation ID, and 7 is the Elaine data-source ID. Select a data source whose PAC and permission model matches the acquisition context.

Submit a generic event

 api_processEvent(string $eventName, array $recipientData, array $metaData = []) accepts a configured event name, recipient data, and optional metadata. Elaine can route the event to subscribed marketing automations, an associated transactional message, or both.

curl --get "$ELAINE_BASE_URL/http/api/api_processEvent" \
  --header "Authorization: Bearer $ELAINE_JWT" \
  --data-urlencode 'json=["orderShipped",{"c_email":"recipient@example.com","e_order_number":"A-12345","e_shipping_provider":"Example Logistics"},{"campaignIds":[42],"msgid":"CRM-EVENT-1001"}]' \
  --data-urlencode 'response=json'

 Event processing is asynchronous. A successful API result confirms that Elaine accepted and routed the event; it does not prove that every downstream automation step or message delivery has completed.

Event data conventions

     
  • Use c_ fields for persistent recipient profile data.
  •  
  • Use configured e_ fields for event data consumed by automations.
  •  
  • Use configured t_ fields for temporary personalization data in transactional messages.
  •  
  • Include a stable external identifier for correlation and duplicate handling.
  •  
  • Configure the event type in Elaine before sending production events.

Note

Function availability and event routing depend on the Elaine release, enabled features, configured event types, campaign subscriptions, and API permissions.