<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Import a list of contacts using a csv file OAuth in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716393#M58557</link>
    <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/13982"&gt;@dennisedson&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/131510"&gt;@webdew&lt;/a&gt;&amp;nbsp;Need your help guys &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Nov 2022 15:03:22 GMT</pubDate>
    <dc:creator>AbdelMOULIDA</dc:creator>
    <dc:date>2022-11-09T15:03:22Z</dc:date>
    <item>
      <title>Import a list of contacts using a csv file OAuth</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716368#M58556</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As HubSpot is going to remove the use of API keys I find myself in a situation to change all my scripts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, I pass the API key in the URL (url variable), now with the OAuth Access Token I don't know how and where to put it to be able to do my contact import.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# .CV file / contacts to import
url = "https://api.hubapi.com/crm/v3/imports?hapikey=MYAPIKEY"
data = {
  "name": "users_import", # import name
  "files": [
    {
      "fileName": "previousdayusers.csv", # .csv filename
      "fileFormat": "CSV",
      "fileImportPage": {
        "hasHeader": True,
        "columnMappings": [
          {
            "ignored": False,
            "columnName": "firstname",
            "idColumnType": None,
            "propertyName": "firstname",
            "foreignKeyType": None,
            "columnObjectType": "CONTACT",
            "associationIdentifierColumn": False
          },
          {
            "ignored": False,
            "columnName": "lastname",
            "idColumnType": None,
            "propertyName": "lastname",
            "foreignKeyType": None,
            "columnObjectType": "CONTACT",
            "associationIdentifierColumn": False
          },
          {
            "ignored": False,
            "columnName": "email",
            "idColumnType": "HUBSPOT_ALTERNATE_ID",
            "propertyName": "email",
            "foreignKeyType": None,
            "columnObjectType": "CONTACT",
            "associationIdentifierColumn": False
          }
        ]
    }
}
]}

# preparing the JSON file / data
datastring = json.dumps(data)
payload = {"importRequest": datastring}
files = [('files', open('previousdayusers.csv','rb'))] # .csv filename

# pushing the contacts
response = requests.request("POST", url, data = payload, files = files)
print(response.text.encode('utf8'))
print(response.status_code)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2022 14:37:36 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716368#M58556</guid>
      <dc:creator>AbdelMOULIDA</dc:creator>
      <dc:date>2022-11-09T14:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: Import a list of contacts using a csv file OAuth</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716393#M58557</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/13982"&gt;@dennisedson&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/131510"&gt;@webdew&lt;/a&gt;&amp;nbsp;Need your help guys &lt;span class="lia-unicode-emoji" title=":folded_hands:"&gt;🙏&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2022 15:03:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716393#M58557</guid>
      <dc:creator>AbdelMOULIDA</dc:creator>
      <dc:date>2022-11-09T15:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Import a list of contacts using a csv file OAuth</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716423#M58561</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/175253"&gt;@AbdelMOULIDA&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I am not a python wizard. Heck I am not even a python wizards apprentice &lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;,&lt;/P&gt;
&lt;P&gt;But I think I can help a bit here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First of all,&amp;nbsp; need to understand if you are doing this for a public facing app or if this is for a single portal.&amp;nbsp; If it is for a public facing app that will be used across many portals, you will need to walk through the process of setting up oauth.&amp;nbsp; &amp;nbsp;Here is a link to the &lt;A href="https://developers.hubspot.com/docs/api/oauth-quickstart-guide" target="_blank" rel="noopener"&gt;quickstart guide.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Setting up a public app is more involved due to oauth.&lt;/P&gt;
&lt;P&gt;If you are setting this up for a single portal, then you would want to reach for a private app.&amp;nbsp; Here is a link to getting started with &lt;A href="https://developers.hubspot.com/docs/api/private-apps" target="_blank" rel="noopener"&gt;private apps&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Setting up a private app is a much more straight forward process.&amp;nbsp; When you create a private app, you will need to identify the scopes for you need then you will be given an access token that you will include in your data being sent as a bearer token in the header.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a stackoverflow link regarding sending a bearer token with Python.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/144301"&gt;@taran42&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/152955"&gt;@zaklein&lt;/a&gt;&amp;nbsp;are both better equipped to answer more Python specific questions than I.&amp;nbsp; Give me a few years and hopefully I will have learned Python.&amp;nbsp; It has been on my bucket list for a LONG time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck out there!&lt;/P&gt;
&lt;P&gt;d&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2022 15:31:52 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716423#M58561</guid>
      <dc:creator>dennisedson</dc:creator>
      <dc:date>2022-11-09T15:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Import a list of contacts using a csv file OAuth</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716428#M58562</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/13982"&gt;@dennisedson&lt;/a&gt;&amp;nbsp; for your feedback.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Okay &lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;, no problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will wait for help from&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/144301"&gt;@taran42&lt;/a&gt;&amp;nbsp; and &lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/152955"&gt;@zaklein&lt;/a&gt;&amp;nbsp; because I have trouble understanding understanding how to follow the steps of private apps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For information, It's a python script that I'm executing automatically once per day to import contact to HubSpot.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Nov 2022 15:38:18 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Import-a-list-of-contacts-using-a-csv-file-OAuth/m-p/716428#M58562</guid>
      <dc:creator>AbdelMOULIDA</dc:creator>
      <dc:date>2022-11-09T15:38:18Z</dc:date>
    </item>
  </channel>
</rss>

