Intercom - Create Contact
@sergio
code:
data:privatelast updated:4 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
intercom_create_contact
Creates a new contact (ie. user or lead).
auth
(auths.intercom)
params
Role

The role of the contact. Accepted values are user or lead.

string ·params.role
Optional
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
}
27
// See the API docs here: https://developers.intercom.com/intercom-api-reference/reference#create-contact
const config = {
  method: "post",
  url: `https://api.intercom.io/contacts`,
  headers: {
    Authorization: `Bearer ${auths.intercom.oauth_access_token}`,
    Accept: 'application/json',
    'Content-Type': 'application/json'
  },
  data:{
    role: params.role,
    external_id: params.external_id,
    email: params.email,
    phone: params.phone,
    name: params.name,
    avatar: params.avatar,        
    signed_up_at: params.signed_up_at,
    last_seen_at: params.last_seen_at,
    owner_id: params.owner_id,
    unsubscribed_from_emails: params.unsubscribed_from_emails,    
    custom_attributes: typeof params.custom_attributes == 'undefined' ? params.custom_attributes : JSON.parse(params.custom_attributes)
  }
}
return await require("@pipedreamhq/platform").axios(this, config)