Campaign, Contact, and Campaign Dispatch. These entities work together to handle the creation, scheduling, and dispatching of messages in large-scale campaigns.
Campaign
TheCampaign entity is the central object in the campaign system. It represents the actual marketing or communication effort that will be sent to multiple recipients. When a campaign is created, it includes the following:
- Contact IDs: A campaign holds a set of one or more Contact IDs, representing the recipients of the campaign. The relationship between the
CampaignandContactis one-to-many, meaning that a single campaign can target multiple contacts. - Schedule: The time at which the campaign will be sent (commonly the current time for immediate dispatch).
Contact
TheContact entity represents an individual recipient. It contains information about the customer, such as their phone number, email, or any other contact details required for the campaign. A single Contact can be associated with multiple campaigns over time.
- Relationship: A
Campaigncan target manyContacts, but eachCampaign Dispatchwill be specific to a singleContact.
Important to understant that to include some contact into a campaign that contact should be previously associated to contact channel specified in campaign or in other case, contact can be attached manually to a specific campaign.
Campaign Dispatch
Once a campaign is initiated, the system generates aCampaign Dispatch object for each Contact in the campaign. The Campaign Dispatch entity represents the actual sending attempt for each recipient and stores critical information about the delivery process, such as:
- Status: Indicates whether the dispatch was successful, failed, or is still pending.
- Timestamp (Schedule At): The exact time when the message was scheduled to be sent.
- Result: Tracks the outcome of the dispatch, including whether the message reached the recipient or if there was an error during transmission.
- Errors: If the message fails due to reasons like a rejection from the gateway (e.g., WhatsApp), the failure reason is logged in the
Campaign Dispatchobject.