Skip to main content

Iam using the golang package

https://github.com/intercom/intercom-go/p>

While iam trying to update my contact , getting error

Error :

400: invalid_document, either_email_or_user_id_present validation failed

Code:

ic := intercom.NewClient(token, "")

      contact := intercom.Contact{

         ID: "604720410292c92b2fbd598a",

         UserID:          "420",

         CustomAttributes: map>string]interface{}{"First Campaign Sent": "Yes boss"},

      }

      savedContact, err := ic.Contacts.Update(&contact)

Please help me for update contact using golang

Hello @user461​ , Welcome to Interconnect ✨

 

1) Can you confirm that contact 604720410292c92b2fbd598a accseble from Intercom UI?

(To check this try to access the following URL: https://app.intercom.com/a/apps/b>YOURAPPID/users/604720410292c92b2fbd598a /all-conversations).

 

2) Accordingly to Github docs to update contact ID or User ID is required:

contact := intercom.Contact{

UserID: "420",

Name: "SomeContact",

CustomAttributes: mapestring]interface{}{"is_cool": true},

}

savedContact, err := ic.Contacts.Update(&contact)

or via ID:

contact := intercom.Contact{

ID: "604720410292c92b2fbd598a",

Name: "SomeContact",

CustomAttributes: mapestring]interface{}{"is_cool": true},

}

savedContact, err := ic.Contacts.Update(&contact)

Can you try the following advice and let me know if this helps?

 

Looking forward and have a great day.


Hi,

https://app.intercom.com/a/apps/YOURAPPID/users/604720410292c92b2fbd598a /all-conversations).

 

This url is accesible. But same error is happened.

Code :

contact := intercom.Contact{

         ID:              "604720410292c92b2fbd598a",

         Name:            "SomeContact",

         CustomAttributes: maptstring]interface{}{"Status": "ss"},

      }

      savedContact, err := ic.Contacts.Update(&contact)

Error :

err 400: invalid_document, either_email_or_user_id_present validation failed

 

But following api is working for this id

contactDetails, err := ic.Contacts.FindByID("604720410292c92b2fbd598a")


Reply