tutorials/SMSMessaging.md in cpaas-sdk-1.0.0 vs tutorials/SMSMessaging.md in cpaas-sdk-1.1.0

- old
+ new

@@ -14,20 +14,19 @@ ``` Before moving to how the response body looks, let's walk through the highlights on the SMS request: + `sender_address` indicates which DID number that user desires to send the SMS from. It is expected to be an E.164 formatted number. + If `sender_address` field contains `default` keyword, $KANDY$ discovers the default assigned SMS DID number for that user and utilizes it as the sender address. -+ `destination_address` can either be an array of phone numbers or a single phone number string within the params containing the destinations that corresponding SMS message will be sent. For v1, only one destination is supported on $KANDY$. ++ `destination_address` can either be an array of phone numbers or a single phone number string within the params containing the destinations that corresponding SMS message will be sent. For SDK v1, only one destination is supported on $KANDY$. + Address value needs to contain a phone number, ideally in E.164 format. Some valid formats are: - +16131234567 - - 6131234567 - tel:+16131234567 - sip:+16131234567@domain - sip:6131234567@domain + `message` field contains the text message in `UTF-8` encoded format. -> The number provided in `sender_address` field should be an assigned/purchased number for the user, otherwise $KANDY$ replies back with a Forbidden error. +> The number provided in `sender_address` field should be purchased by the account and assigned to the project, otherwise $KANDY$ replies back with a Forbidden error. Now, let's check the successful response: ```ruby { @@ -37,13 +36,13 @@ }], message: 'hi :)', sender_address: '+16139998877' } ``` -In case of requesting `default` sender_address usage, sender_address field in response can be used to understand the actual number used since it contains the number being used as from address. +In case of passing `default` as sender_address in the request, the actual number from which sms is sent can be identified with `sender_address` field in the response -> + The delivery_status can have the following values `DeliveredToNetwork`, `DeliveryImpossible` +> + The delivery_status can have the following values: `DeliveredToNetwork`, `DeliveryImpossible` ## Receive SMS To receive SMS, you need to: @@ -58,11 +57,11 @@ type: Cpaas::Conversation.types[:SMS], webhook_url: 'https://myapp.com/inbound-sms/webhook', destination_address: '+16139998877' }) ``` -+ `destination_address` is an optional parameter to indicate which SMS DID number has been desired to receive SMS messages. Corresponding number should be one of the assigned/purchased numbers of the user or project/application, otherwise $KANDY$ replies back with Forbidden error. Also not providing this parameter triggers $KANDY$ to use the default assigned DID number against this user, in which case the response message for the subscription contains the `destination_address` field. It is highly recommended to provide `destination_address` parameter. ++ `destination_address` is an optional parameter to indicate which SMS DID number has been desired to receive SMS messages. Corresponding number should be one of the assigned/purchased numbers of the project, otherwise $KANDY$ replies back with Forbidden error. Also not providing this parameter triggers $KANDY$ to use the default assigned DID number against this user, in which case the response message for the subscription contains the `destination_address` field. It is highly recommended to provide `destination_address` parameter. + `webhook_url` is a webhook that is present in your application which is accessible from the public web. The sms notifications would be delivered to the webhook and the received notification can be consumed by using the `Cpaas::Notification.parse` helper method. The usage of `Cpaas::Notification.parse` is explained in Step 2. A successful subscription would return: ```ruby { @@ -71,10 +70,10 @@ subscription_id: '544f12a3-123ad5e-b169' } ``` > + For every number required to receive incoming SMS, there should be an individual subscription. -> + When a number has been unassigned from a user or project/application, all corresponding inbound SMS subscriptions are cancelled and `sms_subscription_cancellation_notification` notification is sent. +> + When a number has been unassigned from a project, all corresponding inbound SMS subscriptions are cancelled and `sms_subscription_cancellation_notification` notification is sent. Now, you are ready to receive inbound SMS messages via webhook, for example - 'https://myapp.com/inbound-sms/webhook'. ### Step 2: Receiving notification An inbound SMS notification via webhook can be parsed by using the `Cpaas::Notification.parse` method: