Class: Nexmo::Alerts

Inherits:
Namespace
  • Object
show all
Defined in:
lib/nexmo/alerts.rb

Instance Method Summary collapse

Instance Method Details

#listResponse

Request the list of phone numbers opted out from your campaign.


13
14
15
# File 'lib/nexmo/alerts.rb', line 13

def list
  request('/sc/us/alert/opt-in/query/json')
end

#remove(params) ⇒ Response Also known as: resubscribe

Remove a phone number from the opt-out list.

Parameters:

  • params (Hash)

Options Hash (params):

  • :msisdn (required, String)

    The phone number to resubscribe to your campaign and remove from the opt-out list.

Returns:

See Also:


28
29
30
# File 'lib/nexmo/alerts.rb', line 28

def remove(params)
  request('/sc/us/alert/opt-in/manage/json', params: params, type: Post)
end

#send(params) ⇒ Response

Send an alert to your user.

Parameters:

  • params (Hash)

Options Hash (params):

  • :to (required, String)

    The single phone number to send pin to. Mobile number in US format and one recipient per request.

  • :status_report_req (Integer)

    Set to 1 to receive a delivery receipt. To receive the delivery receipt, you have to configure a webhook endpoint in Dashboard.

  • :client_ref (String)

    A 40 character reference string for your internal reporting.

  • :template (Integer)

    If you have multiple templates, this is the index of the template to call. The default template starts is 0, each Event Based Alert campaign can have up to 6 templates. If you have one template only it is the default. That is, template=0. If you create a request with template=1 the API call will default, template=0 instead. After you add a valid campaign alert for 2FA, the request will call template 1 instead of template 0.

  • :type (String)

    Default value is `text`. Possible values are: `text` for plain text SMS or `unicode` only use this when your SMS must contain special characters.

Returns:

See Also:


63
64
65
# File 'lib/nexmo/alerts.rb', line 63

def send(params)
  request('/sc/us/alert/json', params: params, type: Post)
end