Help me with http().post method

86 views
Skip to first unread message

Abu Muhammad

unread,
Apr 24, 2019, 12:14:47 AM4/24/19
to mementodatabase
I want to use whatsapp API from third parties, and from the documentation page I find a way to use it with the following script:


const http = require('superagent')

// Enter API key
const token = 'token'

// Enter target phone number to send message
const phone = '+111111'

// Device to be used for message delivery
const device = '5ca6d9fdc46219001bxxxxxx' // device id

// Enter text message to send
const message =
Hello there!
This is a test message :)


// Send message via API
http
.post('https://api.wassenger.com/v1/messages')
.set('Token', token)
.send({
phone: phone,
message: message,
device: device
})
.then(res => {
console.log('Message sent successfully. See:', https://console.wassenger.com/messages/${res.body.id})
})
.catch(err => {
console.error('Cannot send message:', err.message, (status: ${err.status || err.code})
})


can anyone help me to make this script run on memento??

Reply all
Reply to author
Forward
0 new messages