Skip to content

Commit

Permalink
Adding changelog draft (#123)
Browse files Browse the repository at this point in the history
* Adding changelog draft

* Adding Kumkum's suggestion.
  • Loading branch information
charliesantos authored Oct 26, 2022
1 parent 229197a commit c5381d4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
35 changes: 34 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,40 @@
New Features
------------

TODO: Need to coordinate with DevEd and Backend Docs
### SDK Message Events (Beta)

// TODO: Polish up, add links to public documentation, update API doc links to typedoc after cutting a release

The SDK can now send and receive custom messages to and from Twilio's backend via the following new `Call` APIs.

- [sendMessage](https://twilio.github.io/twilio-voice.js/classes/voice.call.html#sendmessage)
- [messageReceivedEvent](https://twilio.github.io/twilio-voice.js/classes/voice.call.html#messagereceivedevent)
- [messageSentEvent](https://twilio.github.io/twilio-voice.js/classes/voice.call.html#messagesentevent)

**Example**

```js
const device = new Device(token, options);

const setupCallHandlers = call => {
call.on('messageReceived', message => messageReceivedHandler(message));
call.on('messageSent', message => messageSentHandler(message));
};

// For outgoing calls
const call = await device.connect();
setupCallHandlers(call);

// For incoming calls
device.on('incoming', call => setupCallHandlers(call));
await device.register();

// For sending a message
const eventSid = call.sendMessage({
content: { foo: 'foo' },
messageType: Call.MessageType.UserDefinedMessage,
});
```

2.1.2 (In Progress)
=========================
Expand Down
4 changes: 2 additions & 2 deletions lib/twilio/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1537,8 +1537,8 @@ namespace Call {
declare function messageReceivedEvent(message: Call.Message): void;

/**
* Emitted after calling the {@link Call.sendMessage} API and that
* Twilio has received the message.
* Emitted after calling the {@link Call.sendMessage} API.
* This event indicates that Twilio has received the message.
* @param message - A message object that was sent to the Twilio backend.
* @event
*/
Expand Down

0 comments on commit c5381d4

Please sign in to comment.