-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8,127 changed files
with
61,688 additions
and
47 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# Used to verify the integrity of signed cookies. so ensure a secure value is set | ||
SECRET_KEY_BASE=30qE5OWUlCcCEjV0TJMByWY6hECxq2cbmPcRxQIEILzU4NqQUF4TIOTn4TzkzMj | ||
|
||
# Replace with the URL you are planning to use for your app | ||
FRONTEND_URL=http://chat.textyomni.com | ||
|
||
# Force all access to the app over SSL, default is set to false | ||
FORCE_SSL=false | ||
|
||
# This lets you control new sign ups on your chatwoot installation | ||
# true : default option, allows sign ups | ||
# false : disables all the end points related to sign ups | ||
# api_only: disables the UI for signup, but you can create sign ups via the account apis | ||
ENABLE_ACCOUNT_SIGNUP=true | ||
|
||
# Redis config | ||
REDIS_URL=redis://localhost:6379 | ||
# If you are using docker-compose, set this variable's value to be any string, | ||
# which will be the password for the redis service running inside the docker-compose | ||
# to make it secure | ||
REDIS_PASSWORD= | ||
|
||
# Postgres Database config variables | ||
POSTGRES_HOST=localhost | ||
POSTGRES_USERNAME=chatwoot | ||
POSTGRES_PASSWORD=m5Say5OZAjVU6Oi | ||
RAILS_ENV=production | ||
RAILS_MAX_THREADS=5 | ||
|
||
# Mail outgoing | ||
[email protected] | ||
#SMTP_PORT=1025 | ||
SMTP_PORT=587 | ||
SMTP_DOMAIN=textyomni.com | ||
# if you are running docker-compose, set SMTP_ADDRESS value as "mailhog", | ||
# else set the value as "localhost" | ||
SMTP_ADDRESS=smtp.sendgrid.net | ||
SMTP_USERNAME=apikey | ||
SMTP_PASSWORD=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 | ||
SMTP_AUTHENTICATION=plain | ||
SMTP_ENABLE_STARTTLS_AUTO=true | ||
|
||
# Mail Incoming | ||
# This is the domain set for the reply emails when conversation continuity is enabled | ||
MAILER_INBOUND_EMAIL_DOMAIN=usg.mail.textyomni.com | ||
# Set this to appropriate ingress channel with regards to incoming emails | ||
# Possible values are : | ||
# :relay for Exim, Postfix, Qmail | ||
# :mailgun for Mailgun | ||
# :mandrill for Mandrill | ||
# :postmark for Postmark | ||
# :sendgrid for Sendgrid | ||
RAILS_INBOUND_EMAIL_SERVICE=:sendgrid | ||
# Use one of the following based on the email ingress service | ||
# Ref: https://edgeguides.rubyonrails.org/action_mailbox_basics.html | ||
RAILS_INBOUND_EMAIL_PASSWORD=x3fGwQ95vStP | ||
MAILGUN_INGRESS_SIGNING_KEY= | ||
MANDRILL_INGRESS_API_KEY= | ||
|
||
# Storage | ||
ACTIVE_STORAGE_SERVICE=local | ||
|
||
# Amazon S3 | ||
# documentation: https://www.chatwoot.com/docs/configuring-s3-bucket-as-cloud-storage | ||
S3_BUCKET_NAME= | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_REGION= | ||
|
||
# Sentry | ||
SENTRY_DSN= | ||
|
||
# Log settings | ||
# Disable if you want to write logs to a file | ||
RAILS_LOG_TO_STDOUT=true | ||
LOG_LEVEL=info | ||
LOG_SIZE=500 | ||
|
||
### This environment variables are only required if you are setting up social media channels | ||
|
||
# documentation: https://www.chatwoot.com/docs/facebook-setup | ||
FB_VERIFY_TOKEN= | ||
FB_APP_SECRET= | ||
FB_APP_ID= | ||
|
||
# documentation: https://www.chatwoot.com/docs/twitter-app-setup | ||
TWITTER_APP_ID= | ||
TWITTER_CONSUMER_KEY= | ||
TWITTER_CONSUMER_SECRET= | ||
TWITTER_ENVIRONMENT= | ||
|
||
#slack integration | ||
SLACK_CLIENT_ID= | ||
SLACK_CLIENT_SECRET= | ||
|
||
### Change this env variable only if you are using a custom build mobile app | ||
## Mobile app env variables | ||
IOS_APP_ID=6C953F3RX2.com.chatwoot.app | ||
|
||
## Push Notification | ||
## generate a new key value here : https://d3v.one/vapid-key-generator/ | ||
VAPID_PUBLIC_KEY=BH5x28p4-mDyIEsHKvIC648hqM4kWuTxlxxIhXSUMt-ZK73JUDXDV1jKPSif4PlTEWRC7sXGRnzYFZJqFpaafRU | ||
VAPID_PRIVATE_KEY=NGcV6dhwjhnNZLFsHIf73qk3fxnZZ_LwDO4ZtjWifiY | ||
# | ||
# for mobile apps | ||
# FCM_SERVER_KEY= | ||
|
||
## Bot Customizations | ||
USE_INBOX_AVATAR_FOR_BOT=true | ||
|
||
## Development Only Config | ||
# if you want to use letter_opener for local emails | ||
# LETTER_OPENER=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.7.1 | ||
2.7.1@chatwoot_signalwire |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/controllers/api/v1/accounts/channels/signalwire_channels_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
class Api::V1::Accounts::Channels::SignalwireChannelsController < Api::V1::Accounts::BaseController | ||
protect_from_forgery except: :create | ||
before_action :authorize_request | ||
|
||
def create | ||
ActiveRecord::Base.transaction do | ||
authenticate_signal_wire | ||
build_inbox | ||
setup_webhooks if @signal_wire_channel.sms? | ||
render json: @inbox | ||
rescue ::Twilio::REST::SignalwireError => e | ||
render_could_not_create_error(e.message) | ||
rescue StandardError => e | ||
render_could_not_create_error(e.message) | ||
end | ||
end | ||
|
||
private | ||
|
||
def authorize_request | ||
authorize ::Inbox | ||
end | ||
|
||
def authenticate_signal_wire | ||
client = Signalwire::REST::Client.new( | ||
permitted_params[:account_sid], | ||
permitted_params[:auth_token], | ||
signalwire_space_url: permitted_params[:space_url] | ||
) | ||
client.messages.list(limit: 1) | ||
end | ||
|
||
def setup_webhooks | ||
::Signalwire::WebhookSetupService.new(inbox: @inbox).perform | ||
end | ||
|
||
def medium | ||
permitted_params[:medium] | ||
end | ||
|
||
def build_inbox | ||
@signal_wire_channel = Current.account.signalwire_sms.create!( | ||
account_sid: permitted_params[:account_sid], | ||
auth_token: permitted_params[:auth_token], | ||
phone_number: permitted_params[:phone_number], | ||
space_url: permitted_params[:space_url], | ||
medium: medium | ||
) | ||
@inbox = Current.account.inboxes.create( | ||
name: permitted_params[:name], | ||
channel: @signal_wire_channel | ||
) | ||
end | ||
|
||
def permitted_params | ||
params.require(:signalwire_channel).permit( | ||
:account_id, :phone_number, :account_sid, :space_url, :phone_number, :auth_token, :name, :medium | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
class Signalwire::CallbackController < ApplicationController | ||
# protect_from_forgery with: :null_session | ||
protect_from_forgery except: :create | ||
|
||
def create | ||
# { | ||
# "SmsSid"=>"6487c887-4c02-43d5-9b3c-a9fb31b0ee80", | ||
# "From"=>"+13305104190", | ||
# "AccountSid"=>"ce607000-9d51-4699-85d3-f628a36da245", | ||
# "MessageSid"=>"6487c887-4c02-43d5-9b3c-a9fb31b0ee80", | ||
# "To"=>"+13305104190", | ||
# "Body"=>"You've received a 12-character message. Upgrade your Trial account to view this message." | ||
# } | ||
# permitted_params example | ||
# ToDo: remove | ||
::Signalwire::IncomingMessageService.new(params: permitted_params).perform | ||
|
||
head :no_content | ||
end | ||
|
||
private | ||
|
||
def permitted_params | ||
params.permit( | ||
:ApiVersion, | ||
:SmsSid, | ||
:From, | ||
:ToState, | ||
:ToZip, | ||
:AccountSid, | ||
:MessageSid, | ||
:FromCountry, | ||
:ToCity, | ||
:FromCity, | ||
:To, | ||
:FromZip, | ||
:Body, | ||
:ToCountry, | ||
:FromState, | ||
:MediaUrl0, | ||
:MediaContentType0 | ||
) | ||
end | ||
end |
Oops, something went wrong.