Contact toevoegen
Zet een persoon met de hand in het adresboek, en ga om met het geval dat hij of zij er al in staat.
create_contact is de handmatige route naar het adresboek, dezelfde die achter het formulier "contact
toevoegen" van het dashboard zit: een naam en een e-mailadres, met telefoon en bedrijf erbij. Het
adresboek werkt op e-mailadres, dus een adres sturen dat al bestaat is geen fout: je krijgt een
gewoon succes terug dat het contact noemt dat je al hebt.
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.
Stappenplan
Stuur de vier velden die een contact heeft
name en email zijn de enige twee die create_contact vereist. source is standaard manual en
context is standaard Added by hand als je ze weglaat. Beide staan in het eigen activiteitenspoor
van het contact.
Het antwoord
existed: true is het geval van een duplicaat: het e-mailadres stond al in het adresboek, en
contact_id noemt het contact dat het al had, geen nieuw contact. Vertak op existed en niet op
code om de twee gevallen te onderscheiden: beide komen terug als code: 1.
phone en company worden bij het contact opgeslagen maar niet teruggegeven in dit antwoord; lees ze
terug met get_contacts of get_contact_members als je wilt controleren wat is opgeslagen.