example.rb in whatsapp_sdk-0.5.0 vs example.rb in whatsapp_sdk-0.5.1
- old
+ new
@@ -1,5 +1,6 @@
+
# frozen_string_literal: true
# 1) Copy this code into a file and save it `example.rb`
# 2) Replace the `ACCESS_TOKEN` constant with a valid `access_token`.
# 3) Run the file with the command `ruby example.rb`
@@ -9,24 +10,24 @@
gemfile(true) do
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
- gem "whatsapp_sdk", path: "/Users/ignaciochiazzo/src/whatsapp_sdk"
+ gem "whatsapp_sdk", path: "/Users/ignaciochiazzo/src/whatsapp_sdk" # "~> 0.5.0"
gem "pry"
gem "pry-nav"
end
require 'whatsapp_sdk'
require "pry"
require "pry-nav"
################# UPDATE CONSTANTS #################
-ACCESS_TOKEN = "EAAVRvYO3LQMBANyzA38RmXZA83VGGwYblwZASqrEU50dZBki0vqEsGSlglL2nuyD9XVbX0qxbSQURnzW5jkwvfrz8J0P3XW3CSM1R03n81ZBjd1dLHsYIIPdhF8NjMy8hnwYDzTFLSabpkWlD7LQ7VWQAx5k64XgNv02DFLt2EhgVhib09SmEj6ZBSKZBknasHjaTUcgX0iQZDZD" # replace this with a valid access_token # TODO replace
-BUSINESS_ID = 101292429380714
-SENDER_ID = 108129082031154
-RECIPIENT_NUMBER = 5511970395230
+ACCESS_TOKEN = "EAAZAvvr0DZBs0BAHyg1bIPxEVV8dfI6woMaCxGNdjEEWYbZAkrMDuSqJcwXuIX10AmUW5TQLMEQCHM07dYzpGW5rTbZCZAoDt0aixPyZBB2nKFCTGhd3OnyZCZCzAxEdZBbZC4IY9uYkYbC9KCSLfOpAdgBU1dLGCTR2brwAvpWZAosgjXwgQZBLwrOSEpblsMVTGDkNaxAbi8zZBLijYRi6gsaSK" # replace this with a valid access_token # TODO replace
+BUSINESS_ID = 102261539298487
+SENDER_ID = 111591145018464
+RECIPIENT_NUMBER = 13437772910
IMAGE_LINK = "https://ignaciochiazzo.com/static/4c403819b9750c8ad8b20a75308f2a8a/876d5/profile-pic.avif"
################# Initialize Client #################
WhatsappSdk.configure do |config|
@@ -87,10 +88,10 @@
# messages_api.read_message(sender_id: SENDER_ID, message_id: msg_id)
######### SEND AN IMAGE
# Send an image with a link
image_sent = messages_api.send_image(
- sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: media.url, caption: "Ignacio Chiazzo Profile"
+ sender_id: SENDER_ID, recipient_number: RECIPIENT_NUMBER, link: media.url, caption: "Testing"
)
print_message_sent(image_sent)
# Send an image with an id
messages_api.send_image(