Method: Mints::Contact#send_magic_link

Defined in:
lib/contact.rb

Send magic link to contact by email. That magic link will be used in magic_link_login method.

Parameters

email

(String) – Contact’s email.

template_slug

(String) – Email template’s slug to be used in the email.

redirectUrl

(String) – Url to be redirected in the implemented page.

lifeTime

(Integer) – Maximum time of use in minutes.

maxVisits

(Integer) – The maximum number of uses of a token.

First Example

@mints_contact.send_magic_link("[email protected]", "template_slug")

Second Example

@mints_contact.send_magic_link("[email protected]", "template_slug", "", 1440, 3)


141
142
143
144
145
146
147
148
149
150
151
# File 'lib/contact.rb', line 141

def send_magic_link(email, template_slug, redirectUrl = '', lifeTime = 1440, maxVisits = nil)
  data = {
    email: email,
    lifeTime: lifeTime,
    maxVisits: maxVisits,
    redirectUrl: redirectUrl,
    templateId: template_slug
  }
  response = @client.raw("post", "/contacts/magic-link", nil, { data: data }.to_json, '/api/v1')
  return response
end