Skip to content

Instantly share code, notes, and snippets.

@WietseWind
Last active June 25, 2016 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WietseWind/2498043a7f3d71dc4f398bf8b7c83f34 to your computer and use it in GitHub Desktop.
Save WietseWind/2498043a7f3d71dc4f398bf8b7c83f34 to your computer and use it in GitHub Desktop.
Simplicate CRM koppeling (contactformulier) met nodum

Formulier met koppeling naar Simplicate CRM

Met een Slack-nofiticatie. De instellingen dienen in de algemene config opgegeven te worden.

Vervolgens kan een pagina worden gemaakt met een HTML formulier (zie het grootste gedeelte van form.twig), en indien het formulier wordt verzonden wordt eerst een organisatie gemaakt, en daarbij een persoon toegevoegd. Op deze voorbeeldscreenshots is het volgende te zien:

  1. HTML Formulier + nodum-code voor de Simplicate V2 API
  2. Resultaat: een formulier
  3. Het formulier is verzonden
  4. Er komt een Slack notificatie binnen
  5. Er is een organisatie toegevoegd in Simplicate
  6. De organisatie heeft een contactpersoon

nodum.io logo

simplicate.nl logo slack.com logo

[simplicate]
; De API Key en Secret kun je verkrijgen binnen Simplicate, bij Instellingen - Algemeen - API
key = "xxxxxxxxxxxxx1w7KSMtzwp06PjLG"
secret = "xxxxxxxxxxL2l80V89r9wG0sl93SY"
env = "nodum.simplicate.nl"
[notification]
; De Slack URL is er een van het type Webhook, maak deze op:
; https://www.slack.com/apps/new/A0F7XDUAZ-incoming-webhooks
slackurl = "https://hooks.slack.com/services/T03trRCBD6GND/MT5ZWGAJLMW/a9pGlguwNB037T5GlU"
icon = "http://www.simplicate.nl/wp-content/themes/simplicate/assets/press/Simplicate-Beeldmerk-small.png"
sender = "Website"
<h1>Contact</h1>
{% if param.post %}
{% set company = api.Simplicate_V2.crm('organization').set({
name : param.post.company,
phone : param.post.phone,
mail : param.post.mail,
note : param.post.msg ~ "\n\n" ~ 'Via de website @ ' ~ 'now'|date('d-m-Y H:i:s')
}) %}
{% if company.id %}
{% set person = api.Simplicate_V2.crm('person').set({
family_name : param.post.name,
email : param.post.mail,
linked_as_contact_to_organization : [
{ organization_id : company.id, work_email : param.post.mail, work_phone : param.post.phone }
]
}) %}
{% endif %}
{% if person.id %}
<p class="alert alert-groen">Dank je! We nemen zo snel mogelijk contact met je op!</p>
{% do api.Notification_Slack.setTo("#general").setFrom(param.post.name ~ ' van ' ~ param.post.company).setText(param.post.msg).send() %}
{% else %}
<p class="alert alert-oranje">Sorry! Er ging iets mis! Bel je ons?</p>
{% endif %}
{% else %}
<form action="" method="post" class="form-horizontal" role="form">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Naam</label>
<div class="col-sm-10">
<input name="name" id="name" placeholder="Naam" type="text" class="form-control" required>
</div>
</div>
<div class="form-group">
<label for="company" class="col-sm-2 control-label">Bedrijf</label>
<div class="col-sm-10">
<input name="company" id="company" placeholder="Bedrijf" type="text" class="form-control" required>
</div>
</div>
<div class="form-group">
<label for="phone" class="col-sm-2 control-label">Telefoon</label>
<div class="col-sm-10">
<input name="phone" id="phone" placeholder="Telefoon" type="text" class="form-control" required>
</div>
</div>
<div class="form-group">
<label for="mail" class="col-sm-2 control-label">E-mail</label>
<div class="col-sm-10">
<input name="mail" id="mail" placeholder="E-mail" type="email" class="form-control" required>
</div>
</div>
<div class="form-group">
<label for="msg" class="col-sm-2 control-label">Bericht</label>
<div class="col-sm-10">
<textarea name="msg" id="msg" placeholder="Bericht" class="form-control" rows="4" required></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10 pull-right">
<button type="submit" class="btn btn-groen autodisable btn-block waves-effect waves-light">
<i class="fa fa-send"></i>
Versturen
</button>
</div>
</div>
</form>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment