Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
This Ruby SDK provides a convenient and easy-to-use interface to the Direct7 REST API. The SDK allows you to perform all the operations that are available through the REST API.
The SDK is available on RubyGems and can be installed using two methods: Add this line to your application's Gemfile:
gem 'direct7', '~> 0.0.18'
And then execute:
bundle install
Or install it yourself as:
gem install direct7
The SDK is designed to be easy to use. The library needs to be configured with your account's secret key, which is available in your Direct7 Dashboard. To get started, create a client instance by providing the key. If you haven't already, you can Login here to access your dashboard.
require 'direct7'
client = Direct7::Client.new('Your API token')
client.sms.send_message(
originator='SignOTP',
report_url='https://the_url_to_recieve_delivery_report.com',
schedule_time=nil,
{ recipients: ['+919999XXXXXX'], content: 'Greetings from D7 API', unicode: false }
)
require 'direct7'
client = Direct7::Client.new('Your API token')
client.sms.send_message(
originator='SignOTP',
report_url='https://the_url_to_recieve_delivery_report.com',
schedule_time=nil,
{ recipients: ['+919999XXXXXX'], content: "مرحبا بالعالم!", unicode: true }
)
require 'direct7'
client = Direct7::Client.new('Your API token')
# request_id is the id returned in the response of send_message
client.sms.get_status(request_id= '001a1a4e-0221-4cb7-a524-a2a5b337cbe8')
require 'direct7'
client = Direct7::Client.new('Your API token')
client.verify.send_otp(originator="SignOTP", recipient="+97150900XXXX", content = "Greetings from D7 API, your mobile verification code is: {}", expiry = 600, data_coding = "text")
require 'direct7'
client = Direct7::Client.new('Your API token')
client.verify.resend_otp(otp_id="0012c7f5-2ba5-49db-8901-4ee9be6dc8d1")
require 'direct7'
client = Direct7::Client.new('Your API token')
client.verify.verify_otp(otp_id="0012c7f5-2ba5-49db-8901-4ee9be6dc8d1", otp_code="1425")
require 'direct7'
client = Direct7::Client.new('Your API token')
# otp_id is the id returned in the response of send_otp
client.verify.get_status(otp_id="0012c7f5-2ba5-49db-8901-4ee9be6dc8d1")
require 'direct7'
client = Direct7::Client.new('Your API token')
client.viber.send_viber_message(recipients=["+97150900XXXX","+97845900XXX"], content="Greetings from D7 API", label="PROMOTION", originator="INFO2WAY", call_back_url="https://the_url_to_recieve_delivery_report.com")
require 'direct7'
client = Direct7::Client.new('Your API token')
# request_id is the id returned in the response of send_viber_message
client.viber.get_status(request_id="0012c7f5-2ba5-49db-8901-4ee9be6dc8d1")
require 'direct7'
client = Direct7::Client.new('Your API token')
client.slack.send_slack_message(content="Greetings from D7 API", work_space_name="WorkspaceName", channel_name="ChannelName", report_url="https://the_url_to_recieve_delivery_report.com")
require 'direct7'
client = Direct7::Client.new('Your API token')
# request_id is the id returned in the response of send_slack_message
client.slack.get_status(request_id="0012c7f5-2ba5-49db-8901-4ee9be6dc8d1")
require 'direct7'
client = Direct7::Client.new('Your API token')
client.number_lookup.search_number_details(recipient="+914257845XXXX")
require 'direct7'
client = Direct7::Client.new('Your API token')
client.whatsapp.send_whatsapp_freeform_message(
originator='{originator}',
recipient='{recipient}',
message_type='LOCATION',
body=nil, first_name=nil, last_name=nil, formatted_name=nil, middle_name=nil, suffix=nil, prefix=nil, birthday=nil, phones=nil, emails=nil, urls=nil,
latitude='12.93803129081362',
longitude='77.61088653615994',
name='Mobile Pvt Ltd',
address='Bengaluru, Karnataka 56009'
)
require 'direct7'
client = Direct7::Client.new('Your API token')
client.whatsapp.send_whatsapp_templated_message(
originator='{originator}',
recipient='{recipient}',
template_id="{template_id}",
language="en",
body_parameter_values=nil,
media_type="image",
text_header_title=nil,
media_url='https://miro.medium.com/max/780/1*9Wdo1PuiJTZo0Du2A9JLQQ.jpeg'
)
require 'direct7'
client = Direct7::Client.new('Your API token')
parameters = {
"display_text": "Visit Us",
"url": "https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwoEQTICY7W1JKoXvaZOXWAS7h1P76s0R7Paec4"
}
client.whatsapp.send_whatsapp_templated_message(
originator='{originator}',
recipient='{recipient}',
interactive_type= "cta_url",
header_type= "text",
header_text= "Payment$ for D7 Whatsapp Service",
header_link=nil, header_file_name=nil,
body_text= "Direct7 Networks is a messaging service provider that specializes in helping organizations efficiently communicate with their customers.",
footer_text= "Thank You",
parameters= parameters
)
require 'direct7'
client = Direct7::Client.new('Your API token')
# request_id is the id returned in the response of send_message
client.whatsapp.get_status(request_id="0012c7f5-2ba5-49db-8901-4ee9be6dc8d1")
require 'direct7'
client = Direct7::Client.new('Your API token')
# message_id is the id shown in the api reports
client.whatsapp.read_receipt(message_id="9612c7f5-2ba5-49db-8901-4ee9be6dc8d1")
You can get your API token from the Direct7 dashboard. If you don't have an account yet, you can create one for free.
The SDK supports ruby 3.0 and higher.
As of now, the SDK supports the following APIs:
API | Supported? |
---|---|
SMS API | ✅ |
Verify API | ✅ |
Whatsapp API | ✅ |
Number Lookup API | ✅ |
Viber API | ✅ |
Slack API | ✅ |
You can find the platform documentation @ Direct7 Docs.
If you need help using the SDK, you can create an issue on GitHub or email to support@d7networks.com
We welcome contributions to the Direct7 ruby SDK. If you have any ideas for improvements or bug fixes, please feel free to create an issue on GitHub.
FAQs
Unknown package
We found that direct7 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.