createSession method

Future<Map<String, dynamic>> createSession({
  1. String? conversationId,
  2. String? customerName,
  3. String? customerEmail,
  4. String? customerPhone,
  5. int ttlMinutes = 60,
})

Short-lived token for one app user. Send only client_token to the app.

When the user is signed in to your app, pass customerEmail and/or customerPhone (with the country code): the AI then asks for no contact details and knows the customer is signed in.

Implementation

Future<Map<String, dynamic>> createSession(
        {String? conversationId, String? customerName, String? customerEmail, String? customerPhone, int ttlMinutes = 60}) =>
    _req('POST', '/sessions', {
      if (conversationId != null) 'conversation_id': conversationId,
      if (customerName != null) 'customer_name': customerName,
      if (customerEmail != null) 'customer_email': customerEmail,
      if (customerPhone != null) 'customer_phone': customerPhone,
      'ttl_minutes': ttlMinutes,
    });