Chatwoot/db/seeds.rb
Sojan Jose 4b49d21543
chore: Add event for conversations transferred to Bot (#2167)
* chore:  Event for conversation transferred to Bot

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Nithin David <webofnithin@gmail.com>
2021-04-28 20:53:23 +05:30

61 lines
1.9 KiB
Ruby

# loading installation configs
GlobalConfig.clear_cache
ConfigLoader.new.process
## Seeds productions
if Rails.env.production?
# Setup Onboarding flow
::Redis::Alfred.set(::Redis::Alfred::CHATWOOT_INSTALLATION_ONBOARDING, true)
end
## Seeds for Local Development
unless Rails.env.production?
SuperAdmin.create!(email: 'john@acme.inc', password: '123456')
account = Account.create!(
name: 'Acme Inc'
)
user = User.new(name: 'John', email: 'john@acme.inc', password: '123456')
user.skip_confirmation!
user.save!
AccountUser.create!(
account_id: account.id,
user_id: user.id,
role: :administrator
)
web_widget = Channel::WebWidget.create!(account: account, website_url: 'https://acme.inc')
inbox = Inbox.create!(channel: web_widget, account: account, name: 'Acme Support')
InboxMember.create!(user: user, inbox: inbox)
contact = Contact.create!(name: 'jane', email: 'jane@example.com', phone_number: '+2320000', account: account)
contact_inbox = ContactInbox.create!(inbox: inbox, contact: contact, source_id: user.id, hmac_verified: true)
conversation = Conversation.create!(
account: account,
inbox: inbox,
status: :open,
assignee: user,
contact: contact,
contact_inbox: contact_inbox,
additional_attributes: {}
)
# sample email collect
WootMessageSeeder.create_sample_email_collect_message conversation
Message.create!(content: 'Hello', account: account, inbox: inbox, conversation: conversation, message_type: :incoming)
# sample card
WootMessageSeeder.create_sample_cards_message conversation
# input select
WootMessageSeeder.create_sample_input_select_message conversation
# form
WootMessageSeeder.create_sample_form_message conversation
# articles
WootMessageSeeder.create_sample_articles_message conversation
CannedResponse.create!(account: account, short_code: 'start', content: 'Hello welcome to chatwoot.')
end