Einen Kontakt hinzufügen
Lege eine Person von Hand im Kontaktbuch an und behandle den Fall, dass sie schon darin steht.
create_contact ist der Weg, einen Kontakt von Hand ins Kontaktbuch einzutragen, derselbe wie hinter dem
Formular "Kontakt hinzufügen" des Dashboards: ein Name und eine E-Mail-Adresse, dazu optional Telefon und Firma. Das Buch
ist nach E-Mail-Adresse geschlüsselt, daher ist das Senden einer bereits vorhandenen kein Fehler, sondern kommt als normaler
Erfolg zurück und nennt den Kontakt, den du schon hast.
Methode
Create Contact
Adds a person to the contact book by hand, from typed details rather than from a received message. Takes only the fields a contact has, name, email, phone, company, job title and its kind (personal or business, which then needs no model to classify it), and ignores anything else the caller happens to hold, such as a shipping address. The email is the book's key, so it is required and a repeat of one already filed returns the existing contact instead of a second copy.
Schritt für Schritt
Sende die vier Felder, die ein Kontakt hat
name und email sind die einzigen beiden Felder, die create_contact verlangt. source ist standardmäßig manual und
context standardmäßig Added by hand, wenn du sie weglässt. Beide erscheinen im eigenen Aktivitätsverlauf des Kontakts.
Die Antwort
existed: true ist der Duplikatpfad: Die E-Mail-Adresse war bereits im Buch, und contact_id nennt
den Kontakt, der sie schon hatte, nicht einen neuen. Unterscheide die beiden Fälle über existed, nicht über code,
beide kommen als code: 1 zurück.
phone und company werden am Kontakt gespeichert, aber in dieser Antwort nicht zurückgegeben. Lies sie
mit get_contacts oder get_contact_members zurück, wenn du bestätigen willst, was gespeichert wurde.