Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
signalboost
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
55
Issues
55
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
team-friendo
signalboost
Commits
15274f9a
Verified
Commit
15274f9a
authored
Sep 21, 2019
by
aguestuser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ns] add trust boost command
parent
d5fdb70c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
1 deletion
+49
-1
cli/boost
cli/boost
+3
-1
cli/boost-commands/help
cli/boost-commands/help
+3
-0
cli/boost-commands/trust
cli/boost-commands/trust
+43
-0
No files found.
cli/boost
View file @
15274f9a
...
...
@@ -22,6 +22,7 @@ print_usage(){
echo
" list-channels"
echo
" list-numbers"
echo
" release-numbers"
echo
" trust"
echo
""
echo
"To learn what these commands do, run:"
echo
""
...
...
@@ -34,7 +35,8 @@ if [[ $command != "help" ]] &&
[[
$command
!=
"create-number"
]]
&&
[[
$command
!=
"list-channels"
]]
&&
[[
$command
!=
"list-numbers"
]]
&&
[[
$command
!=
"release-numbers"
]]
[[
$command
!=
"release-numbers"
]]
&&
[[
$command
!=
"trust"
]]
then
print_usage
exit
1
...
...
cli/boost-commands/help
View file @
15274f9a
...
...
@@ -21,6 +21,9 @@ boost cli supports the following commands:
release-numbers <path>
- releases all phone numbers with twilio ids listed at given path
trust <user phone number>
- trusts all safety numbers associated with a user's phone number
for more detailed instructions on any command, run:
boost <command> -h
...
...
cli/boost-commands/trust
0 → 100755
View file @
15274f9a
#!/usr/bin/env bash
if
[[
$1
==
"-h"
]]
||
[[
$1
==
"--help"
]]
;
then
echo
"this command trusts all safety numbers associated with a user's phone number. valid options are:"
echo
""
echo
"-p : user phone number"
;
echo
"-u : url to target (in dev, use signalboost.ngrok.io)"
;
echo
""
exit
1
fi
echo
"--- checking environment and args..."
if
[
-z
$SIGNALBOOST_API_TOKEN
]
;
then
echo
"--- ERROR: no SIGNALBOOST_API_TOKEN found. try
\`\$
set -a && source .env && set +a
\`
"
exit
1
fi
while
getopts
":p:n:s:u:"
opt
;
do
case
"
$opt
"
in
p
)
phone_number
=
"
$OPTARG
"
;;
u
)
url
=
"
$OPTARG
"
;;
esac
done
if
[[
!
$phone_number
=
~ ^
\+
(
1|52
)[
0-9]
{
10
}
$
]]
;
then
echo
"> ERROR: -p must be a 10 digit phone number prefixed by a country code (+1 or +52)"
exit
1
fi
if
[
-z
$url
]
;
then
url
=
${
SIGNALBOOST_HOST_URL
}
;
fi
echo
"--- trusting all safety numbers for user phone number
${
phone_number
}
at url
${
url
}
"
curl
-s
-X
POST
\
-H
"Content-Type: application/json"
\
-H
"Token:
$SIGNALBOOST_API_TOKEN
"
\
-d
"{
\"
memberPhoneNumber
\"
:
\"
$phone_number
\"
}"
\
https://
${
url
}
/channels | jq
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment