UNPKG

@zenvia/sdk

Version:

This SDK for [Node.js](https://nodejs.org/) was created based on the [Zenvia](https://www.zenvia.com/) [API](https://zenvia.github.io/zenvia-openapi-spec/).

29 lines (24 loc) 619 B
/** * Example to create a webhook to receive messages. * * Run: * ZENVIA_API_TOKEN=your-api-token node subscription-create-message.js */ // const { Client, MessageSubscription } = require('@zenvia/sdk'); const { Client, MessageSubscription } = require('../dist'); const client = new Client(process.env.ZENVIA_API_TOKEN); const subscription = new MessageSubscription( { url: 'https://my-webhook.company.com' }, { channel: 'whatsapp', } ); client.createSubscription(subscription) .then(response => { console.log('Response:', response); }) .catch(error => { console.log('Error:', error); });