In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use nodejs to create Marketing Cloud contact data", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to use nodejs to create Marketing Cloud contact data"!
The source code is as follows:
Var config = require (". / mcConfig"); var request = require ('request'); var url = config.tokenURL;console.log ("user:" + config.user + "password:" + config.password) Var getTokenOptions = {url: url, method: "GET", json:true, headers: {'Authorization':' Basic'+ new Buffer (config.user + ":" + config.password) .toString ('base64'), "content-type": "application/json", "x-csrf-token": "fetch"}} Function getToken () {return new Promise (function (resolve,reject) {var requestC = request.defaults ({jar: true}); console.log ("Step1: get csrf token via url:" + url); requestC (getTokenOptions,function (error,response,body) {var csrfToken = response.headers]; if (! csrfToken) {reject ({message: "token fetch error:" + error}); return } console.log ("Step1: csrf token got:" + csrfToken); resolve (csrfToken);};}) } function createContact (token) {return new Promise (function (resolve, reject) {var oPostData = {"CountryCode": "CN", "City": "Chengdu", "FirstName": "Jerry4", "LastName": "Wang2", "PostalCode": "610093", "RegionCode": "" "Street": "Tianfu Software Park", "HouseNumber": "Tianfu Software Park", "DateofBirth": null, "ContactPersonFacets": [{"Id": "jerry1@sap.com", "IdOrigin": "EMAIL" "Obsolete": false, "Invalid": false}, {"Id": "," IdOrigin ":" PHONE "," Obsolete ": false," Invalid ": false} {"Id": "IdOrigin": "MOBILE", "Obsolete": false, "Invalid": false}, {"Id": "", "IdOrigin": "FAX" "Obsolete": false, "Invalid": false}], "IsConsumer": true, "Filter": {"MarketingAreaId": "CXXGLOBAL"}} Var requestC = request.defaults ({jar: true}) Var createOptions = {url: config.createContactURL, method: "POST", json:true, headers: {"content-type": "application/json", 'Xmurcsrf: token}, body:oPostData} RequestC (createOptions,function (error,response,data) {if (error) {reject (error.message);} else {var oCreatedContact = data; console.log ("created contact ID:" + oCreatedContact.d.ContactPersonId); resolve (data);}});}) } getToken () .then (createContact) .catch ((error) = > {console.log ("error:" + error.message);})
Here I hard-code the name field of the created contact into Jerry4:
Execute the js file using nodejs to output the successfully created contact guid:
See this successfully created contact on Marketing Cloud UI:
Thank you for reading, the above is "how to use nodejs to create Marketing Cloud contact data" content, after the study of this article, I believe you have a deeper understanding of how to use nodejs to create Marketing Cloud contact data, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.