Reference guide for accessing Advertisement type within Contentful
Reference guide for interacting with a Contentful item type
Contentful Name | Contentful ID | CONTENTFUL TYPE |
---|---|---|
Creative Name | creativeName | text |
Advertisement ID | sys.id | text |
Promotion Idea | promotionIdea | reference |
Tags | (pending) | reference |
Category | creativeType | reference |
Copywriter | copywriter | reference |
Main Ad Image | mainImage | reference |
Headline | headline | text |
Sub Headline | subHeadline | text |
Status | status | text |
Copy | copy | richText |
Call To Action | cta | text |
Start Date | startDate | date |
Expiration Date | expirationDate | date |
Button Color | buttonColor | reference |
Item | item | reference |
Journey URL | journeyUrl | text |
Promo Code | promoCode | text |
Example Advertisement Payload(Javascript)
This is an example of a payload received by a contentful webhook.
The term “entry” is a name we declared in code and can be changed.
The “sys” name is provided directly from contentful and contains this entry’s id.
Each “entry” contains a subset of fields, which contain all the items provided in the table above.
For reference fields, we want to re-fetch those types by passing the id provided in those fields.
{ "Creative Name": entry.fields.creativeName, "Advertisement Id": sys.id, "Promotion Idea": entry.fields.promotionIdea, "Tags": entry.fields.tags, (reference) "Category": entry.fields.creativeType, (reference) "Copywriter": entry.fields.copywriter, (reference) "Main Ad Image": entry.fields.mainImage, (reference) "Headline": entry.fields.headline, "Sub Headline": entry.fields.subHeadline, "Status": entry.fields.status, "Copy": entry.fields.copy, "Call To Action": entry.fields.cta, "Start Date": entry.fields.startDate, "Expiration Date":entry.fields.expirationDate, "Button Color": entry.fields.buttonColor,(reference) "Item": entry.fields.item, (reference) "Journey URL": entry.fields.journeyUrl, "Promo Code": entry.fields.promoCode }