Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tsa1
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Renzo Mauro Ontivero
tsa1
Commits
4dd6db9c
Commit
4dd6db9c
authored
5 years ago
by
Renzo Mauro Ontivero
⚽
Browse files
Options
Downloads
Patches
Plain Diff
Añadiendo envio de whatsapp Celo
parent
2172a25f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/controllers/CeloController.js
+13
-0
13 additions, 0 deletions
api/controllers/CeloController.js
api/helpers/enviar-whatsapp.js
+76
-0
76 additions, 0 deletions
api/helpers/enviar-whatsapp.js
with
89 additions
and
0 deletions
api/controllers/CeloController.js
+
13
−
0
View file @
4dd6db9c
...
...
@@ -61,6 +61,19 @@ module.exports = {
// 19. Print new balance
console
.
log
(
`Your new account balance:
${
balance
.
toString
()}
`
)
if
(
req
.
body
.
phone
){
var
notificacion
=
`Your transaction was successfully sent ! The hash is
${
receipt
.
transactionHash
}
. Greetings team Celo`
;
// Notifico por whatsapp
await
sails
.
helpers
.
enviarWhatsapp
.
with
({
texto
:
notificacion
numero
:
req
.
body
.
phone
,
});
}
return
res
.
json
({
status
:
'
ok
'
,
tx
:
receipt
...
...
This diff is collapsed.
Click to expand it.
api/helpers/enviar-whatsapp.js
0 → 100755
+
76
−
0
View file @
4dd6db9c
const
axios
=
require
(
'
axios
'
);
const
querystring
=
require
(
'
querystring
'
);
// Luego modificar envíos por POST
module
.
exports
=
{
friendlyName
:
'
Enviar whatsapp
'
,
description
:
''
,
inputs
:
{
texto
:
{
type
:
'
string
'
,
require
:
true
},
numero
:
{
type
:
'
string
'
,
require
:
true
}
},
exits
:
{
success
:
{
description
:
'
All done.
'
,
},
},
fn
:
async
function
(
inputs
)
{
var
data
=
querystring
.
stringify
({
texto
:
inputs
.
texto
,
telefono
:
inputs
.
telefono
});
const
response
=
await
axios
.
get
(
'
http://190.105.227.247/~umbot/api-whatsapp/?
'
+
data
)
.
then
((
response
)
=>
{
return
response
;
})
.
catch
((
err
)
=>
{
return
{
status
:
201
,
statusText
:
String
(
err
.
message
),
}
});
// Respuesta
if
(
response
.
status
==
200
&&
response
.
statusText
==
'
OK
'
){
sails
.
log
.
info
(
'
Send whatsapp complete:
\n
'
+
util
.
inspect
(
inputs
,{
depth
:
null
})
);
return
{
status
:
'
ok
'
,
};
}
else
{
sails
.
log
.
info
(
'
Send whatsapp incomplete:
\n
'
+
util
.
inspect
(
inputs
,{
depth
:
null
})
);
return
{
status
:
'
fail
'
};
}
}
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment